#help-development

1 messages Β· Page 1866 of 1

opal juniper
#

wdym nms entities

quaint mantle
#

when i go far away he forgets this stuff

#

i think he despawns and respawns

#

do you know of a fix

opal juniper
#

nope, nms is naturally unsupported and i am not sure. I thought this could be accomplished otherways in the API but im not sure

lunar forge
#

I have a EntityPlayer/NPC, and I tried to use Entityplayer#move, but it won't do anything. Do I need to sent a packet or..?

quaint mantle
#

yes

lunar forge
#

What packet?

quaint mantle
#

Assuming you spawned it with packets

lunar forge
#

Yes

quaint mantle
#

Entity Move?

opal juniper
#

Entity Position and Rotation

chrome beacon
quaint mantle
lunar forge
# opal juniper Entity Position and Rotation

Do I need to do this?

nmsHelper.sendPacket(Player, new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.entityID, x, y, z, true));``` 
Because if I do that, it will just fly to a random location
quaint mantle
#

how would you manually laod it? seems more intensive imo

opal juniper
#

like everytime it moves

chrome beacon
lunar forge
opal juniper
#

no - what i mean is teh animations looks smooth cause there are more movement packets

#

you cant send a move packet for more than 8 blocks iirc

#

then it is a teleport packet

quaint mantle
#

tbh just spawn a zombie and disguise it as player

quaint mantle
quaint mantle
rough drift
#
libraries:
  - org.bstats:bstats-bukkit:2.2.1
  - org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin.version}
  - org.openjdk.nashorn:nashorn-core:15.3
```i added those as libs
quaint mantle
#

Much easier IMO

rough drift
#

however the plugin is still not loading

lunar forge
opal juniper
lunar forge
#

Ahh, now I get it

chrome beacon
chrome beacon
tidal skiff
#

anyone know how to reset a map back to its original state after a game is over

#

ive tried jordan osterbergs tutorial but its way too quick

lunar forge
#

@opal juniper Can I send you a message in DM?

opal juniper
#

no, keep it here please

#

i cant always help and others can

lunar forge
#

I can't send screenshots here

opal juniper
#

verify

quaint mantle
#

does anyone know what all the despawn methods in NMS are

#

i want to override every single one so my mob deosnt despawn

tardy delta
#

Entity#remove?

#

thats bukkit code but wouldnt that suffice?

quaint mantle
#

its just easier

#

i swear its possible but idk how

tardy delta
#

as LivingEntity#setDespawnWhenFarAway

quaint mantle
#

i want it to keep its behaviour

#

that doesnt work 😦

#

it loses its behaviours

tardy delta
#

which behaviour?

quaint mantle
#

like

#

heres my class

#
public class NMSPanda extends Panda {

    public NMSPanda(Location loc) {
        super(EntityType.PANDA, ((CraftWorld) loc.getWorld()).getHandle());
        Level craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
//        this.goalSelector.removeAllGoals();
        this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 8.0F));
        this.setPos(loc.getX(), loc.getY(), loc.getZ());
        System.out.println(isPersistenceRequired() + " is1");
        this.setPersistenceRequired(true);
        System.out.println(isPersistenceRequired() + " is2");
        craftWorld.getWorld().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
    }

    public void travel(Vec3 vec3){

    }

    public boolean hurt(DamageSource damagesource, float f){
        return false;
    }


    public void playAmbientSound() {
    }

    public void addAdditionalSaveData(CompoundTag nbttagcompound) {
        super.addAdditionalSaveData(nbttagcompound);
        Bukkit.getServer().broadcastMessage("y1");
//        nbttagcompound.putInt("DespawnDelay", 0);
        nbttagcompound.putString("MainGene", this.getMainGene().getName());
        nbttagcompound.putString("HiddenGene", this.getHiddenGene().getName());
    }

    public void readAdditionalSaveData(CompoundTag nbttagcompound) {
        super.readAdditionalSaveData(nbttagcompound);
        Bukkit.getServer().broadcastMessage("x1");
//        this.goalSelector.removeAllGoals();
//        this.checkDespawn();
        this.setMainGene(Panda.Gene.byName(nbttagcompound.getString("MainGene")));
        this.setHiddenGene(Panda.Gene.byName(nbttagcompound.getString("HiddenGene")));
//        this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 8.0F));
    }
#

messy bc im trying stuff

#

    public void travel(Vec3 vec3){

    }

    public boolean hurt(DamageSource damagesource, float f){
        return false;
    }


    public void playAmbientSound() {
    }

``` i want thse to stick
tardy delta
#

this.persistent = true;?

quaint mantle
#

doesnt work either

opaque plaza
#

can you check for something like this.setPersistent

quaint mantle
#

System.out.println(isPersistenceRequired() + " is1");
this.setPersistenceRequired(true);
System.out.println(isPersistenceRequired() + " is2");

#

true on both accounts ^

chrome beacon
#

The problem is when Minecraft is reading the save it's creating a normal Panda not yours

#

If you really don't want to do what I said earlier with spawning it yourself, you will have to register your entity so the server knows how to create it

#

Wrong channel

severe folio
#

im trying to get a string list from my lang.yml, and ive triple checked the spelling of everything, but it still returns an empty list... wtf```yml
kick-messages:
disallow-message:
- "&cTest"


```java
List<String> messageList = langConfig.getStringList("kick-messages.disallow-message");

The config is 100% loaded and working cause every normal message (non-list) works completely fine.

#

WAIT nevermind im an idiot

#

wow you can tell i was nearly asleep when i wrote this code

buoyant viper
#

if ur not writing ur code in the most ungodly hours are u really coding?

quaint mantle
#

soo it is possible

analog prairie
#
>et
[22:10:19] [Server thread/WARN]: Unexpected exception while parsing console command "et"
org.bukkit.command.CommandException: Unhandled exception executing command 'et' in plugin Spigot-ExpTech v22w01-pre1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:821) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchServerCommand(CraftServer.java:806) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
at net.minecraft.server.dedicated.DedicatedServer.bf(DedicatedServer.java:453) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:429) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1206) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1034) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3378-Spigot-8965a50-0ba6b90]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ClassCastException: class command.command cannot be cast to class org.bukkit.plugin.Plugin (command.command is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @13a6aa5c; org.bukkit.plugin.Plugin is in unnamed module of loader java.net.URLClassLoader @15327b79)
at command.command.onCommand(command.java:16) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
>
#

What's wrong?

young knoll
#

It tells you

rough drift
analog prairie
#
package command;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;

public class command implements CommandExecutor{

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        //console(ChatColor.RED+" "+label);
        //console(ChatColor.RED+" "+args[0]);
        Bukkit.getPluginManager().disablePlugin((Plugin) this);
        Bukkit.getPluginManager().enablePlugin((Plugin) this);
        return false;
    }

    public  void console(String data){
        Bukkit.getConsoleSender().sendMessage(data);
    }
}
young knoll
#

β€œCommand” is not a plugin class

#

You can’t just blindly cast to plugin

rough drift
#

once calling disable you can't call enable

upper niche
analog prairie
#
package command;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public class command implements CommandExecutor{


    private final JavaPlugin plugin;

    public command(JavaPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        //console(ChatColor.RED+" "+label);
        //console(ChatColor.RED+" "+args[0]);
        plugin.getServer().getPluginManager().disablePlugin(plugin);
        plugin.getServer().getPluginManager().enablePlugin(plugin);
        return false;
    }

    public  void console(String data){
        Bukkit.getConsoleSender().sendMessage(data);
    }
}
#

Is this correct?

upper niche
#

that will work

analog prairie
#

This will error

upper niche
#

oh right im stupid

upper niche
#

just make sure whatever you name the command is in the plugin yml

analog prairie
#

Cannot resolve symbol'commands'

upper niche
#

command, not commands
my bad

analog prairie
#
@Override
    public void onEnable() {
        new command(this);
        getCommand("<whatever>").setExecutor(new command());
    }
slow snow
#

How can I find a player by their name on the bungee network, and then send a message only to him?

upper niche
analog prairie
upper niche
#

let me guess

#

the command is null

analog prairie
#
package command;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public class command implements CommandExecutor{


    private final JavaPlugin plugin;

    public command(JavaPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        //console(ChatColor.RED+" "+label);
        //console(ChatColor.RED+" "+args[0]);
        plugin.getServer().getPluginManager().disablePlugin(plugin);
        plugin.getServer().getPluginManager().enablePlugin(plugin);
        return false;
    }

    public  void console(String data){
        Bukkit.getConsoleSender().sendMessage(data);
    }
}
#

'command(org.bukkit.plugin.java.JavaPlugin)' in'command.command' cannot be applied to'()'

quaint mantle
#

?learnjava when

undone axleBOT
rough basin
#

I have a Collection of Entity. What should I put in .contains() to get the player's Entity?

rough basin
#

bruh i really hates google translation

quaint mantle
#

learn english πŸ˜‰

analog prairie
rough basin
#

what should i insert to get Entity of player?

upper niche
quaint mantle
dense heath
analog prairie
upper niche
#

ill take that as a yes

analog prairie
#

Is this be print by my code or spigot

quaint mantle
#

there's should be getNearbyEntites which takes Class as argument

upper niche
dense heath
# rough basin yeah
List<Player> players = entry.getWorld().getNearbyEntities(box).filter((entity) -> entity instanceof Player).map((entity) -> (Player) entity).collect(Collectors.toList());
rough basin
#

oh it has filter

#

Thanks bro

dense heath
#

No problem. It isn't super efficient, but it will do what you want.

rough basin
#

List<Player> players = sentry.getWorld().getNearbyEntities(box).stream().filter((entity) -> entity instanceof Player).map((entity) -> (Player) entity).collect(Collectors.toList());

dense heath
#

Whoops lmao, forgot the ".stream()"

rough basin
#

is it ok now?

dense heath
#

Should be. Try it out.

rough basin
#

Thanks :)

tardy delta
#

not too set?

analog prairie
#

Can I use command with space?

#

getCommand("et reload")).setExecutor(new command(this);

tardy delta
#

not possible

#

make a subcommand instead

#

handle the "et" command and then check for subcommands

analog prairie
#

Oh

#

Got it

tardy delta
#

what's the point of analizing code before pushing to github?

prime harness
#

hi guys can you help me please to config preventportbypass plugin

chrome beacon
quaint mantle
tardy delta
#

is it checking for errors in your code?

rough basin
#

Is there any problem with converting the Player object to a LivingEntity?

chrome beacon
#

No

#

:)

rough basin
#

Thanks

chrome beacon
#

I recommend reading the javadocs

#

?jd-s

undone axleBOT
ivory sleet
rough basin
#

hmm

dense heath
round finch
#

where to learn lambda?

rough basin
#

?lamda

round finch
#

java lambda

#

?lambda

tardy delta
#

on google i guess?

round finch
#

hmmm on internet?

#

;3

round finch
tardy delta
#

what do you even mean "learning"

#

like it isnt difficult :C

#
round finch
#

for what i have seen long **$
lambda lines

#

i'm justing hitting like yeah ok i'm lost

tardy delta
#

what are you struggling with?

round finch
#
    public Optional<Group> getTopGroup(User user, Track track) {
        SortedSet<Node> allNodes = user.getDistinctNodes();
        if (!allNodes.isEmpty()) {
            GroupManager groupManager = luckPerms.getGroupManager();
            return allNodes.stream()
                    .filter(NodeType.INHERITANCE::matches)
                    .map(NodeType.INHERITANCE::cast)
                    .map(InheritanceNode::getGroupName)
                    .map(groupManager::getGroup)
                    .filter(Objects::nonNull)
                    .filter(track::containsGroup)
                    .max(Comparator.comparingInt(g -> g.getWeight().orElse(0)));
        }
        return Optional.empty();
    }
worldly ingot
#

In short, lambdas are just condensed methods.
public void method(String input1, int input2)
Can be represented as a lambda
(input1, input2) -> { /* the implementation of that function */ }

#

If you refer to some existing method that matches the signature of that method, you can do Type::theMethod or instance::theMethod

round finch
#

but damm that code looks crazy

worldly ingot
#

So those .map() methods just accept a Function<T, R> where T is the input type and R is the return type

tardy delta
#

SortedSet :kekw:

worldly ingot
#

and Function has a method called accept(T) that returns R

#

However, that snippet above is really going overkill with the calls to .map(). That should really all be condensed into one

round finch
#

Note: i took this from LuckyPerms API

worldly ingot
#

.map(node -> groupManager.getGroup(NodeType.INHERITANCE.cast(node).getGroupName())

#

Would be equivalent to those 3 map functions

#

Can just be done all in one

tardy delta
#

the lp api goes brr tho

swift adder
#

my intellij isnt working

round finch
#

:3 <-- looks like face

swift adder
#

some reason it doesnt like adding plugins

#

or dependencys

tardy delta
#

thats not intellij not working

swift adder
#

ik

#

it's not getting the library

tardy delta
#

hava you added the jars?

vale ember
#

plz help, i created gradle sub-modules for each mc version. but when i compile it (with java 11, bc i want 1.13+) it gives me bad class file: /home/areg/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.jar(/net/minecraft/nbt/NBTTagCompound.class)
class file has wrong version 60.0, should be 55.0

tardy delta
#

1.13+ is also java8 no?

vale ember
#

java 11 is supported by 1.13, idk about java 8

worldly ingot
#

Bukkit supported Java 6 for the longest time

#

Like, Bukkit only started making use of Java 8 features around 1.12 or something

#

CraftBukkit had compiled against 8 in 1.13 though, yes. If I recall correctly, Mojang required 8 a version or two before Bukkit made the jump

vale ember
worldly ingot
#

1.17 requires Java 16

vale ember
#

i know

worldly ingot
#

and you're using it as a dependency

vale ember
#

yes, for specific sub-module

#

not whole project

worldly ingot
#

If you're referring to NMS, yeah, that's going to be an issue. You'll have to set the Java version of each subproject

#

Then compile the whole thing with Java 16

vale ember
#

yep, i refer to nms

#

if i use java 16 it wont work on 1.13

worldly ingot
#

I compile VeinMiner against 8, but Fabric mod against 17 (because I obviously need to support the latest client)

#

However I run Gradle with Java 17

#

Even if you're running Gradle with a modern version of Java, it will compile your project against the version it has set in its build.gradle

vale ember
#

i tried to run gradle with java 17, and the plugin didn't run on 1.13 server, saying that it has wrong class version

worldly ingot
#

Then your sub-project's build.gradle isn't defined properly telling Gradle to build with 8

#

I'm not familiar enough with Gradle to help you with that though. I'm barely scraping by with VeinMiner. I'm usually a Maven user

vale ember
#

so i should set java version in global build gradle to 11, and in 1.17/1.18 sub module to 16/17?

worldly ingot
#

Your parent build.gradle shouldn't have any version defined at all

vale ember
#

okay

#

but the whole project is in parent

worldly ingot
#

o.O Then that's a very strange setup

#

Your parent gradle project should contain nothing much more than build files

tardy delta
#

how do i return something async with the bukkitscheduler?

#

i guess its not possible

#

completablefuture prob

vale ember
#

i have a module for shared stuff that accessed and in main project, as well as in nms modules, and the whole project is in parent dir

worldly ingot
#

Ideally you'd have a common project that all of your dependents rely on (like an API of sorts), and each of your subprojects will build with it shaded (or shadowed in)

#

Yeah, Brush, CompletableFuture

quaint mantle
tardy delta
#

something i hate it that java doesnt has pointers πŸ‘€

worldly ingot
#

No pointers, no, but it does make use of references

vale ember
#

i should define version with

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(16))
    }
}
```?, if yes, then it gives me error
worldly ingot
#

So if you edit a List you're going to be able to modify that from any thread

#

(taking into account thread safety)

vale ember
#

No matching variant of project :v1_17_R1 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:

quaint mantle
#

What's pointer

tardy delta
#

im doing stuff like this but that return isnt valid

worldly ingot
#

Again I'm not super informed on Gradle. I really dislike working with it at all so I'm not the best to be asking about topics like this. Even setting basic Java versions in Gradle files seems stupidly overcomplicated to me because you can do it in 12 different ways lol

worldly ingot
#

Yeah that will have to return a CompletableFuture. It would look more like this

public CompletableFuture<User> getUserAsync(UUID uuid) {
    CompletableFuture<User> result = new CompletableFuture<>();
    Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> result.complete(getUser0(uuid)));
    return result;
}```
#

(notice also how I changed it so that it's called getUserAsync() so it's a distinct method)

#

Can then operate on that result. getUserAsync(uuid).whenComplete((user, e) -> {})

tardy delta
#

it should have a sync and an async version πŸ‘€ thats why i made the getUser0 method

worldly ingot
#

Yeah so you'd also have a getUser(UUID) that runs synchronously

#

You're better to keep the methods separate because otherwise you're returning a completed CompletableFuture. Which is fine, you can just call .get(), it's just not super intuitive

quaint mantle
#

private final Executor asyncExecutor = r -> scheduler.runTaskAsync(plugin, r);
return CompletableFuture.supplyAsync(supplier, asyncExecutor)

worldly ingot
#

Yeah, supplyAsync() is also another option, you're then not bound to Bukkit's scheduler

#

It's likely going to return much quicker rather than on the next tick

#

At least assuming you don't use Bukkit's scheduler as an Executor lol

quaint mantle
#

well, i use scheduler as executor

#

Didnt know that it runs after 1 tick

vale ember
#

anyone, who worked with gradle, how can i fix this?

No matching variant of project :v1_17_R1 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'apiElements' capability com.aregcraft.delta:v1_17_R1:1.0-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 16 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)

tardy delta
#

i want to return the actual user object, not the future

#

or i should do what choco said πŸ‘€

vale ember
#

someone, please, how am i supposed to compile plugin with multiple java versions with gradle?

#
  • Variant 'apiElements' capability com.aregcraft.delta:v1_18_R1:1.0-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally:
    - Incompatible because this component declares an API of a component compatible with Java 16 and the consumer needed a runtime of a component compatible with Java 11
quaint mantle
waxen plinth
#

Is there a stack trace?

#

Anything more to that error?

quaint mantle
#

hold it didn't send one. Let me fix that.

quaint mantle
tardy delta
#

im struggling

quaint mantle
#

You cant return User Object instantly, thats not how concurrency works ;>

vale ember
#

how would i even include nms modules to the root project?

#

i use implementation rn

tardy delta
swift adder
#

why is my thing brokeb

#

help help help

chrome beacon
#

Try 1.18.1

swift adder
#

i did and it gave me the same issue

chrome beacon
#

Did you add the spigot repo?

swift adder
#

it automatically does

#

it works on my other computer

#

how could i check my java version?

chrome beacon
#

java -version

swift adder
#

im running 17

chrome beacon
#

You could try what Intellij suggests

swift adder
#

it doesnt suggest non

#

where do i find suggestions?

chrome beacon
#

Clean up the broken artifacts data and reload the project

#

It's literally there

#

Click it

swift adder
#

i did

#

it continues

chrome beacon
#

hm

red sedge
#

how can I see if clicked inventory is player's inventory

chrome beacon
#

I don't know then

#

Do an instance of check on getClickedInventory

red sedge
#

and how do I check that

#

p.getInventory doesnt work

chrome beacon
#

You check it against the PlayerInventory class

red sedge
#

hm

#

if (e.getClickedInventory() == PlayerInventory.class)

#

idk

chrome beacon
#

No instanceof

#

(and remove .class)

red sedge
#

got it

swift adder
#

just do it

#

duh

tardy delta
#

so this would work?

#

ignore that random uuid

red sedge
#

wait nvm

#

i forgot to refresh the jar

#

sorry

vale ember
#

please help 😭 how would i setup the root build.gradle.kts for multi-module gradle project, with some modules having different java versions than others

somber hull
#

So i am trying to make a plugin that has a gui where you can store spawners and then collect the XP via the GUI. If i wanted to calculate how much XP someone should get how do i do that?

#

I have the item storage all done

somber hull
#

Save a time in the item for the last time xp was generated?

#

And then generate based off that time?

#

But then how would i get the amount of XP based off the time?

proud basin
#

not the ones that disables and enables plugins

chrome beacon
somber hull
chrome beacon
#

You can use that if you want but it could cause weird behavior if the server shutsdown or freezes for a while

chrome beacon
vale ember
#

and i understand that the error is bc the versions is incompatible, but there must be some way to make multi module projects, right?

chrome beacon
#

Then set java in each gradle file

#

Make sure it matches what you're building against

vale ember
#

the 1.18 and 1.17 modules can't match to other modules

#

they require java 16+ and 1.13 require java 11

#

there must be some way to make plugin 1.13+ right?

chrome beacon
#

1.13 can use Java 8

vale ember
#

but 1.17 can't

#

right?

chrome beacon
#

Yeah

vale ember
#

so i want support for both 1.17 and 1.13

#

for different nms modules

tardy delta
chrome beacon
#

Looks fine

#

But try it and see

vale ember
#

so what should i do????

chrome beacon
#

Set the java versions

tardy delta
#

I put everything in the whencomplete code

#

Never done that

vale ember
# chrome beacon Set the java versions

i don't understand, i set the java versions for 1.17 and 1.18 modules to ```kotlin
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}

#

it dont work either with ```kotlin
toolchain {
languageVersion.set(JavaLanguageVersion.of(16))
}

severe folio
#

doesnt 1.18 require Java 17

vale ember
#

the 1.17 dont work either

chrome beacon
#

1.18 needs Java 17 and the target should be Java 8

quasi flint
#

can someone tell me, why the hell this crashes any forge client when joining?

chrome beacon
#

or 11 if that's your target

quasi flint
#

@EventHandler
public void onServerConnected(PostLoginEvent event) {
//Wir senden Packet ID 1
//Wir wollen empfangen Packet ID 2
event.getPlayer().sendData(FMLHS13, new byte[]{4, 1, 0, 0, 0});
}

#

private static final String FMLHS13 = "fml:handshake";

chrome beacon
#

Try looking at the stacktrace

#

And then at what's happening in the forge code

quasi flint
#

just an random illegal stack trace

#

although its just documented like i did at wiki.vg

vale ember
# chrome beacon or 11 if that's your target

so?

java {
    sourceCompatibility = JavaVersion.VERSION_16
    targetCompatibility = JavaVersion.VERSION_11
}
``` if yes, then it throws same error, Incompatible because this component declares an API of a component compatible with Java 16 and the consumer needed a runtime of a component compatible with Java 11
chrome beacon
#

Is that your 1.17 gradle file?

vale ember
#

yep

chrome beacon
#

also make sure to actually be using a java 17 jdk

vale ember
#

if i use java 16 jdk how would java 11 modules compile?

chrome beacon
#

No

ivory sleet
#

use the tool chain πŸ˜›

ancient plank
#

ur a tool chain uwu

ivory sleet
ancient plank
#

owo?

paper viper
#

it downloads the proper jdk for u

vale ember
#

i compiled it with jdk 16 and it don't run on 1.13 now

chrome beacon
#

You didn't set target to java 11

vale ember
#

where?

proud basin
#

bump

chrome beacon
chrome beacon
proud basin
#

I think so idk

worldly ingot
#

Even setting basic Java versions in Gradle files seems stupidly overcomplicated to me because you can do it in 12 different ways lol
haha fuck Gradle, honestly

#

I can't keep up

ancient plank
#

πŸ˜”

chrome beacon
proud basin
#

wlel

chrome beacon
#

What do you want

ancient plank
#

my only experience with gradle is when doing forge/fabric and new forge/fabric projects take 50 years to open

vale ember
#

aaaaa

chrome beacon
proud basin
#

and it automatically updates the jar

vale ember
#

help me

chrome beacon
#

with?

#

Did you do what I told you

vale ember
#

when i set target version it throws error

chrome beacon
#

what error

vale ember
#
  • Variant 'runtimeElements' capability com.aregcraft.delta:v1_18_R1:1.0-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
    - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 11
chrome beacon
#

You need Java 17

quaint mantle
vale ember
#

same with java 17

quaint mantle
#

gradle cool 😠

chrome beacon
visual tide
#

javac on top

vale ember
#

anyone else know gradle?

chrome beacon
hasty prawn
#

What's gradle

tender shard
#

the Minecraft plugin for IntelliJ sucks so hard

#

what features does it actually add that are useful for anything?

#

All I see is it causing crashes and adding text color to strings

vale ember
#

please help

vale ember
tender shard
#

you should use subprojects for your different NMS versions instead of just throwing them all in your main project

tender shard
tender shard
chrome beacon
#

It helps with Mixings and ATs

#

Things like that

chrome beacon
#

Put the entire thing on github

vale ember
#

the gradle files are here

chrome beacon
#

That's not the entire thing if you're using submodules

#

Now go put the entire project on github

buoyant viper
tender shard
#

I just find it annoying for spigot, because all it does there is cause problems lol

chrome beacon
#

Never had any major issues with it

tender shard
#

select a String, Alt+Enter -> First thing (the i18n option) instantly crashes it

#

I mean a String literal ofc

vale ember
bronze notch
#

Hi there, I'm currently storing per-player-files which all contain a field with a number in it. I also made a function which sorts all files based on the number. When I want to display e.g. number 2 on a scoreboard, I need to call this function and get the second item from the list. But this gets pretty heavy when there's a lot of player files and when the scoreboard is updating every second. What would you suggest?

I was thinking about double storing the number in a small 'top' list, but this does not feel like the right solution.

tender shard
#

e.g. make a class PlayerData that has every option your file has anyway

#

e.g.

public class PlayerData {
  long number;
  String someThing;

  ...
}

or records when using recent java versions

kindred valley
#

!print

#

?print

bronze notch
#

That sounds like a nice solution!

hasty prawn
#

?paste

undone axleBOT
hasty prawn
#

?

vale ember
hollow sand
#

Hello I wanted to ask. How would I be able to make the user customize the config.yml so they could change settings of the plugin?

waxen plinth
#

Look into FileConfiguration

#

Your plugin has one by default

tender shard
#

Now you can access with getConfig().getString("value1");

waxen plinth
#

getConfig() saveConfig()

hollow sand
tender shard
#

after that you can reload it using reloadConfig()

#

that's everyting needed

hollow sand
#

I mean like

rough drift
#

So on ServerA i have 4 values (2 longs and 2 doubles), i am writing them to a ByteArrayDataOutput and sending it as a byte array, so far so good, right? well when i receive it on the bungee and bounce it to ServerB it receives like 10qd when the original value was 10, why's that?

hollow sand
#

for an example

#

theres a cooldown for an item like an enderpearl. And you make it longer or shorter by default. But you can change the cooldown via config

tender shard
#

getConfig().getInt("cooldown")

#

and in config.yml:

#

cooldown: 20

hollow sand
#

ooooh

#

I see

proud basin
# chrome beacon wdym idk?

well you know how the some prem plugins have a loader for their plugins and it automatically updates the jar

hollow sand
#

Thank you!

tender shard
#

np

vale ember
chrome beacon
proud basin
#

but you know what I mean right

tender shard
#

yep it's part of craftbukkit iirc

#

just download your .jar to the update/ folder and bukkit replaces it on next startup

tender shard
rough drift
#

readLong()
readLong()
readDouble()
readDouble()

(its in a loop since multiple sets are sent, could that be an issue?)

alpine urchin
#

a bit more code

#

just send us the whole file

rough drift
#
try {
  while(true)
    UserData.setPlayer(Bukkit.getOfflinePlayer(UUID.fromString(in.readUTF())), in);
} catch (Exception ignored) {}
```I know its a bad idea i just don't have the full length of the data, so i just run until i straight up can't anymore
#
UserData data = new UserData().readFrom(in);
Bukkit.broadcastMessage("Incoming data for player " + p.getName() + ": " + data);
data.set(p);
```thats the method
#

for setPlayer

#
this.a = in.readLong();
this.b = in.readLong();
this.c = in.readDouble();
this.d = in.readDouble();
#

that's for readFrom

#
out.writeLong(this.a);
out.writeLong(this.b);
out.writeDouble(this.c);
out.writeDouble(this.d);
#

that's writeTo (for writing the data)

quaint mantle
#

while(true)

alpine urchin
#

i mean you are only showing us snippets

#

its hard to find mistakes for you

#

the whole file could be better

#

no one here has time to "judge" your code

#

and we forget about it anyway after a while

#

if it helps you feel better, delete your messages afterwards

alpine urchin
#

ok lol

rough drift
#

i am just sending snippets since my internet is shit and doesn't like large files

alpine urchin
#

just some people are kind of hesetant to show code

#

oh ok

#

some people just are like "someone will steal my code!!"

rough drift
#

large is relative here, its pretty small files

#

like its staking multiple seconds to send these msgs

#
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("PlayerData");
            try {
                while (true) {
                    out.writeUTF(player.getUniqueId().toString());
                    out.writeLong(in.readLong());
                    out.writeLong(in.readLong());
                    out.writeDouble(in.readDouble());
                    out.writeDouble(in.readDouble());
                }
            } catch (Exception ignored) {}
```thats the code for reading the data on the bungee, then it is sent to all servers  but the one it came from
rough drift
quaint mantle
#

Why the fuck while(true)

rough drift
#

since it has no method to know what's the size

quaint mantle
#

😐 Just write size first

#

And then retrieve it

rough drift
#

i don't have size... before i write the data

tender shard
#

there's also a method to see whether the stream has ended

#

but no idea what its called lol

rough drift
quaint mantle
rough drift
#

not really

#

it depends if a player did an action

#

and it sends all players at once

#

so i can't just put the size of players * the size of data

#

otherwise it would be way easier

#

hold on ill brb

hollow bluff
#

in AsyncPlayerChatEvent, is it possible to only send the message format to specified players?

tacit drift
#

Spigot 1.8.8

#

it just throws an exception??

chrome beacon
#

Looks like it

#

fun times

#

I'm pretty sure that should work jokes aside

#

Not sure why it looks like that

vale ember
chrome beacon
#

Try asking Paper. They're generally better with Gradle

frosty geyser
blazing scarab
hollow bluff
frosty geyser
#

yeah you can do that

blazing scarab
tender shard
#

IntelliJ being stupid again... how tf should I make this (@Getter ... instance) final?

blazing scarab
#

lombok

#

singletone

kindred valley
#

?paste

undone axleBOT
frosty geyser
#

you could do a "for" loop for the array and for each player in a list format their chat

#

here is a example of a way you could do it inside the event instead of a for loop

e.setCanceled(true);
//then broadcast the message with the format
  }
}```
all it does is checks if the array contains the player then it will cancel their message then broadcast a message with the format you would want
hollow bluff
#

I didn't think of it like that, I went the wrong way and tried for (Player player : array) which obviously did not work, thanks!

frosty geyser
#

np

quaint mantle
#

Hi, would anyone be able to help me try and code my first plugin in Java? Im using IntelliJ Community and have no experience coding java, (Mainly python).

delicate lynx
#

?learnjava

undone axleBOT
pseudo geyser
#

How can i set a double chest? I looked in all spigot threads that i founded about that but nothing worked for me. Version: 1.18.1

waxen plinth
#

Create two BlockData instances of type Chest

#

Make sure to cast to the Chest BlockData

#

Set one to left (there should be a setType method or similar)

#

Set the other to right

#

And set them to be facing opposite directions as appropriate

#

Then set the left one on one block and the right one adjacent to it appropriately

#

Make sure to use setBlockData(data, false)

#

That way it won't update the block upon being placed and immediately change back to a single chest

pseudo geyser
#
            e.getDrops().clear();
            Location loc = player.getLocation();
            Block leftSide = loc.getBlock();
            Block rightSide = loc.clone().add(0, 0, -1).getBlock();

            leftSide.setType(Material.CHEST);
            rightSide.setType(Material.CHEST);

            BlockData leftData = leftSide.getBlockData();
            ((Directional) leftData).setFacing(BlockFace.EAST);
            leftSide.setBlockData(leftData);

            org.bukkit.block.data.type.Chest chestLeftData = (org.bukkit.block.data.type.Chest) leftData;
            chestLeftData.setType(Type.RIGHT);
            leftSide.setBlockData(chestLeftData);

            Chest leftChest = (Chest) leftSide.getState();
            Chest rightChest = (Chest) rightSide.getState();
            leftChest.setCustomName(ChatColor.GOLD + e.getEntity().getName() + ChatColor.RED + "'s Death Chest");
            rightChest.setCustomName(ChatColor.GOLD + e.getEntity().getName() + ChatColor.RED + "'s Death Chest");
            rightChest.update();
            leftChest.update();

            BlockData rightData = rightSide.getBlockData();
            ((Directional) rightData).setFacing(BlockFace.EAST);
            rightSide.setBlockData(rightData);

            org.bukkit.block.data.type.Chest chestRightData = (org.bukkit.block.data.type.Chest) rightData;
            chestRightData.setType(Type.RIGHT);
            rightSide.setBlockData(chestRightData);

            DoubleChestInventory inventory = (DoubleChestInventory) leftChest.getInventory();
            inventory.setStorageContents(player.getInventory().getContents());

waxen plinth
#

You're calling setBlockData without passing the second arg

#

Pass the second arg as false

#

Also you don't need to set them to chests to get the chest block data

#

You can just do Material.CHEST.createBlockData()

pseudo geyser
#

ok thank you, i will try it

vale ember
#

how would i fix java version error

pseudo geyser
tender shard
#

?jd

tender shard
red sedge
#

how to make the player's inventory update

#

manually

frosty geyser
tender shard
#

Player#updateInventory

waxen plinth
#

Step 1. Check docs

#

Step 2. Look it up

#

Step 3. Ask for help

quaint mantle
waxen plinth
#

Lots of this stuff is very easy to look up in docs or on google

waxen plinth
#

We're not here to hold your hand through the learning process, but we can help you along the way

#

You need to help yourself first though

quaint mantle
#

I found a YT vid by Kody Simpson it’s in parts πŸ™‚

waxen plinth
#

Okay

#

Note that YouTube videos never give the full picture and have a tendency to oversimplify

red sedge
waxen plinth
#

It's always a good idea to read docs to supplement tutorials

tender shard
waxen plinth
#

Gotta get that ad money

cunning warren
#

I made a game using a datapack, but want to combine the LibsDisguises plugin with it.
So what i want my plugin to do, is check for players' NBT-data and check if they have a certain tag (vanilla /tag), and then running a command from the LibsDisguises Plugin using the (stored?) player that passed the tag-check, ultimately disguising them.

Note: I know basic (C#) code but am new to java / plugins in general. I also know i shouldn't be combining datapacks & plugins but that's just how things turned out.

I thought I'd find the best answers here, Thanks in advance.

red sedge
#

and thats how we end our 54 hour part about integers

unreal quartz
#

I do like me some "interger"

waxen plinth
#

?

austere sinew
#

So i am doing a plugin with custom config files and learning to use them but, I am running into an error.

This is the error: https://mcpaste.io/300f3d5680a21a92

So what the code is supposed to do is it should create the config file here: https://paste.md-5.net/azigucacor.java

Then in the main file there is a event handler that should look to see if you click on a diamond ore and if you don't it just returns. After it check that you click a diamond ore it sets amount to 0. Then it should check to see if you already have a entry and then if you do not have one it should create one. Then it should add 1 to the amount so that the count goes up inside data.yml. Here is the file for that: https://paste.md-5.net/yatumovibe.java

also I am following a tutorial and he does the same thing but it works

mighty pier
#

double killerhealth = killer.getAttribute(Attribute.GENERIC_MAX_HEALTH);

lavish hemlock
#

it returns AttributeInstance not double

#

you need to use the AttributeInstance to get the actual value.

mighty pier
#

ok

cunning warren
#

if possible

lavish hemlock
#

look at the fucking API lmao

#

?javadocs

#

?javadoc

wet breach
# austere sinew So i am doing a plugin with custom config files and learning to use them but, I ...

https://paste.md-5.net/azigucacor.java#L22
this will save config.yml that is in the jar, but you don't call any methods to create data.yml. add in there your reloadConfig() method. Second the error is complaining about an NPE in your listener for the event. I am assuming because data.yml doesn't exist since you never invoked the method to create the data.yml file just the one that creates config.yml

quaint mantle
#

I'm trying to make a blank spigot plugin. I am following the tutorial on the website and it refers to a spigot-api-shaded.jar file ... that i don't find anywere

cunning warren
#

ran into the same problem earlier, if it's the first jar file its just the one from the server

quaint mantle
#

so I simply download spigot-1.18.jar and use it as external resource with javadoc?

cunning warren
#

I think so, I am a beginner too though πŸ˜‰

quaint mantle
#

I recall it used to work like this but I may be wrong, so that why i was asking

wet breach
#

?bt

undone axleBOT
wet breach
#

you can use BuildTools which will install the API into your local maven repo, or you can go to the second link and download the api jar

#

or you can use the second link as defining the repo for maven to pull the API from

quaint mantle
#

what's the difference from using the actual server spigot.jar? asking out of curiosity

onyx fjord
#

You can't just get a jar

#

You have to build it

wet breach
#

the API you can

#

server jar no

onyx fjord
#

Yea but you don't get it in maven local

wet breach
# quaint mantle what's the difference from using the actual server spigot.jar? asking out of cur...

Main difference is that the server jar contains more methods or access to more things, but not necessarily things you may want to use and occasionally can end up using the wrong things, also the code for the server jar changes between versions usually which means methods used from the server jar might stay the same, but work differently or both. The API doesn't change often and most everyone just only needs that and it has documentation server jar doesn't πŸ™‚

wet breach
onyx fjord
#

I know that's what I'm talking about

cunning warren
wet breach
#

link is above for buildtools πŸ™‚

#

it will build the api and server jar for you

onyx fjord
#

And mapping

#

Hars

cunning warren
#

honestly sorry for spamming, but I've been stuck with this problem for a while now. I don't know if it's just not possible but how do I test if players have a tag (vanilla command /tag)?

onyx fjord
#

Jars

quaint mantle
cunning warren
#

ye helped me out too ty

quaint mantle
onyx fjord
cunning warren
#

no it's just a vanilla ./tag command

#

./tag [player] add [tagname], and it will be stored in the NBT data

#

i think

quaint mantle
cunning warren
quaint mantle
#

why the shaded.jar must be used as api interface? Because it already has some dependencies inside it?

cunning warren
#

spent the whole evening searching for it

austere sinew
wet breach
#

nope, but it should be a new one though

#

did the data.yml file get created?

austere sinew
#

ya

#

thats the weird thing

wet breach
#

awesome, we are making progress now πŸ™‚

austere sinew
#

thanks for the help so far btw

wet breach
#

alright so I already know what the NPE is now complaining about though

#

so, now it isn't complaining about data.yml however your code assumes there is data in it

austere sinew
#

oooh

#

but there isnt

#

there is nothing in it that is why

#

i think

wet breach
#

yep data.yml is blank so you need to check that data actually exists

wet breach
austere sinew
#

oh ok

#

so if it is empty then I would tell it to add it right?

wet breach
#

or null, because you can have empty values in there

austere sinew
#

ok i will try that

wet breach
#

first check if its null, then if not null check if its empty

austere sinew
#

ok

wet breach
#

in either case just update it πŸ™‚

#

And it should stop complaining lol

austere sinew
#

lol ok

#

ty

severe prism
#

Hey, i used Inventory's larger than 6*9 in previous projects of mine, how can i do that in spigot 1.17 or higher?

#

because if i try it gives me an error saying its not allowed anymore

sullen marlin
#

you cant

severe prism
#

Ok, because it was removed from Mojang or because its removed from spigot itself?

sullen marlin
#

mojang

severe prism
#

Ok, thank you

rancid snow
#

How can I move a zombie while keeping its head with its body?

#

I tried teleporting the mob every 10 ticks with 15 more yaw, but then the head lags behind like 90deg from the body

echo granite
#

My question is, which package am I supposed to shade? it's not written anywhere...

sullen marlin
#

spigot includes mysql

#

you do not need to shade anything

echo granite
#

okay so I removed the dependency, but the class MysqlDataSource is now unreachable

sullen marlin
#

you should not be using mysql classes directly

#

mysql is a jdbc driver, you code using jdbc

queen gulch
#

adding custom textures to a custom chestplate through optifine. how does optifine cit know which one to change though?

echo granite
#

instead of using ConnectionManager

#

so I need to use ConnectionManager instead?

lavish hemlock
rancid snow
#

is there a way to teleport an entity and have it turn immediately, no turning?

quaint mantle
#

is it possible to "reload plugin folder on file change"?

#

so i don't have the hassle to do it manually

#

if there is any option or something

echo granite
#

From spigot's wiki: Of course spigot has some kind of mysql database driver included, however this driver was never really intended to be used by the public and is also pretty old (As of 14.4.2021 the version is 5.1.49. Latest is 8.0.23). So you will be good with getting your own version of it. Also your plugin will break whenever the driver path changes, or the driver is relocated. In fact the spigot way doesn't work with paper anymore, and I want to provide a general best practise on this page. You can find the latest mysql driver here. Throw this in your gradle, maven or whatever and don't forget to shade and relocate this.

sullen marlin
#

whatever that wiki page is it is crap

#

its a wiki, anyone can write anything

echo granite
#

okay, so if I go with you, I need to use ConnectionManager?

sullen marlin
#

use it exactly as any other jdbc driver / mysql tutorial

echo granite
#

yeah that's what they always suggest

sullen marlin
#

DriverManager.getConnection

echo granite
#

exactly

#

okay thanks!

sullen marlin
#

and consider deleting that wiki page, it sounds like crap

echo granite
#

it's a huge wiki page lol

unreal quartz
#

the wiki in general is a mess

echo saddle
#

is there a non-NMS way to check if an entity has AI?

unreal quartz
golden turret
#

how can i get that info

unreal quartz
#

what info

golden turret
#

the delay

#

attack delay

quaint mantle
unreal quartz
golden turret
#

bruh, how i didnt saw that

#

thanks

light parcel
#

Mockito plugin.getServer still null after being set

woeful crescent
#

hey guys, maven isn't building with plugin.yml

#

can anyone help?

#

plugin.yml does not appear in the root of my maven-enabled plugins

quaint mantle
#

Did you include it as resource?

#

You have to place it into the resource folder

#

And it will do the magic

woeful crescent
#

ohh, got it

#

thanks!

quaint mantle
#

You are very welcome

mental moon
#

What would be an efficient way to check if an entity has line of sight to the sky?
Like how the game knows to set an undead on fire if out in the sun.

young knoll
#

I usually use getHighestBlock at their location

#

It’s not perfect, but it uses heightmaps so it’s pretty fast

patent horizon
#

vault init. problem

quaint mantle
#

how can you access/manage the whitelist from a plugin?

patent horizon
#

im assuming the whitelist is a lot like the banlist on spigot's side

buoyant viper
#

(this is referring to a class extending JavaPlugin)

young knoll
#

Bukkit.getServer works too iirc

#

And is static

paper viper
#

only use static with static

buoyant viper
paper viper
#

never use Bukkit.getServer if u can just get it from ur current instance

buoyant viper
#

^ exactly what i was talkin abt lol

ivory sleet
#

Probably doesn't matter but yeah Plugin::getServer is slightly better

quaint mantle
#

what about for adding/removing players?

buoyant viper
#

oh haha woops so it looks like

#

guess u do that from Player instead

quaint mantle
#

ah thank you

young knoll
#

Dont make me static everything

unreal quartz
#

I'll static you instead

buoyant viper
#

static is fun

#

shocking people is fun

young knoll
#

Mean

quaint mantle
#

on startup my custom config / yml file doesnt seem to be being created. this is the code i have

        if(this.configFile == null)
            this.configFile = new File(this.main.getDataFolder(), "data.yml");

        if(this.configFile.exists()) {
            this.main.saveResource("data.yml", false);
        }
polar pagoda
#

im having trouble with my pom.xml file (dm for screenshot since i cant upload files)

patent horizon
#

just verify ezpz

polar pagoda
#

i cant

#

the bot is broken

fathom cobalt
paper viper
#

Or simply use ?paste

#

lol

polar pagoda
#

embeds dont work

#

anyways there

ivory sleet
#

you probably want to check for the config file's absence, not presence

quaint mantle
#

hello wveryone

ivory sleet
#

sup

quaint mantle
#

last attempt of asking here

#

but

ivory sleet
#

ask away

quaint mantle
#

does anyone know how to make NMS entities keep their overidden behaviour on despawn

#

or just prevent the despawn

#

my wandering trader villagers do this

#

but i want to use a panda

ivory sleet
#

best way would be to derive a custom entity

quaint mantle
#

ive overidden the damage+move methods so they dont move

ivory sleet
#

since the entity instance may be invalidated and reinstantiated on chunk unload or such

quaint mantle
#

i wouldnt want to check and re-spawn even tho thays probs the best option

ivory sleet
#

and then your injections on the entity will be lost

quaint mantle
#

ye

#

but it works for villagertraders

#

so idk why theres no hack for other entities

#

wandering traders stay the same no matter how far u go or how long

#

i just set the despawn timer to 0 on them

#

i think there might be a way in material or like block.getsound

#

step sound or smth

mental moon
quaint mantle
#

is there a way to tell if it wasnt vanilla

ivory sleet
#

derive = extend

quaint mantle
#

i have my class ill show u

#

i posted it st like 1am

golden turret
#

which is the correct note for that

fathom cobalt
#

uhh, when I filter materials where itemMeta is instanceOf Damageable, I still get all materials in the game

#

any idea why that is?

#
    return Material.values()
        .filter { it.name.contains(query, true) }
        .filter { ItemStack(it).itemMeta is Damageable }
        .sortedBy { it.name }
        .map { it.name }```
young knoll
#

I’m pretty sure all ItemMeta is actually damageable

#

For some reason

fathom cobalt
#

:lolbert:

#

makes sense

mental moon
golden turret
mental moon
# golden turret which octave

I think 1.
It starts at 0 right?
I made a really bad tracker plugin that messed with the note system and I remember the octave system being a pain

golden turret
#

than the note block

#

the nearest i saw is 0

quaint mantle
#

when using paths for custom configs how would i make one entree have multiple things under like

players:
uuid
def players uuid etc

#

players., value doesnt work

fathom cobalt
#

how would I check if an ItemStack is a tool or weapon?

tender shard
fathom cobalt
#

is there really no other way?

tender shard
#

no

fathom cobalt
#

πŸ˜’

tender shard
#

I do the same thing in besttools, it's just a few lines

mental moon
tender shard
#

a bit ugly but basically you just need all the pickaxes, hoes, axes etc ina list

fathom cobalt
#

thanks!

wet breach
young knoll
#

EnchantmentTarget.TOOL.includes(Material)

wet breach
#

but I doubt half octaves are implemented πŸ˜›

quaint mantle
golden turret
#

fuuck

#

i am

#

using

#

the wrong

#

instrument

wet breach
#

that could explain a lot

fathom cobalt
#

I'll do it like this

tender shard
#

ItemStack(it).isToolOrWeapon()?

young knoll
#

It’s a bit weird how the enchantment targets are basically Tags, but it works

tender shard
#

is that a paper method? spigot doesn't have any ItemStack#isToolOrWeapon method

unreal quartz
mental moon
tender shard
unreal quartz
#

that is an array

fathom cobalt
tender shard
#

yeah but you will still have to check by your own logic whether sth is a tool or weapon

unreal quartz
#

well you are using those arrays exclusively for searching, and since they have unique entries, a set is better suited for it

fathom cobalt
tender shard
unreal quartz
#

then ignore everything I have just said

buoyant viper
#

do fire ticks accumulate or do they get clamped once the player isnt actively in a fire source (fire, lava, etc)

tender shard
unreal quartz
#

lol

young knoll
#

EnchantmentTarget.TRIDENT

lavish hemlock
#

I don't think shears are typically used as tools tho

buoyant viper
#

wool?

tender shard
#

or leaves

polar pagoda
#

Vehicle Event Help

fathom cobalt
#

thanks

tender shard
#

it's like a pickaxe for leaves / vines

lavish hemlock
#

whether or not they're tools in-game does not matter

#

they are not of a tool type

mental moon
lavish hemlock
#

and likelihood is that they don't matter enough to be targeted

fathom cobalt
#
fun ItemStack.isToolOrWeapon(): Boolean {
    val name = this.type.name
    return when {
        name.contains("SWORD") -> true
        name.contains("AXE") -> true
        name.contains("SHOVEL") -> true
        name.contains("BOW") && this.type != Material.BOWL -> true
        name.contains("HOE") -> true
        name.contains("TRIDENT") -> true
        name.contains("SHEARS") -> true
        name.contains("FISHING_ROD") -> true
        name.contains("FLINT_AND_STEEL") -> true
        else -> false
    }
}```
okay, guess this covers all the tools/weapons
buoyant viper
#

do gotta include compass and clock

fathom cobalt
#

does compass have durability?

buoyant viper
#

and lead and nametag..

fathom cobalt
#

oh

#

nvm me

tender shard
fathom cobalt
#

I was just thinking for my use case, while my method is generally checking for tools and weapons

#

changed my method to isToolOrWeaponWithDurability(), bit long, but explains what it does lol

tender shard
#

is there anything with durability except armor / elytra that is NOT a tool or weapon?

buoyant viper
#

anvils :smug:

fathom cobalt
#

well, I'm after all tools and weapons that has durability

#

blocks don't count in this case

buoyant viper
#

ik

tender shard
#

and they don't really have durability

buoyant viper
#

i mean they do break after enough uses

tender shard
#

yeah sure but they don't have getDurability

fathom cobalt
#

okay, it works

tender shard
#

whoa that font lol

buoyant viper
#

sphaxbd iirc

#

al;so what the FUCK just beeped in my room

fathom cobalt
#

purebdcraft is my texturepack indeed

fathom cobalt
young knoll
tender shard
#

comic sans ftw

mental moon
buoyant viper
fathom cobalt
fathom cobalt
buoyant viper
#

purebd and faithful 32x πŸ™

tender shard
#

shit now I forgot the default font

fathom cobalt
#

I use 256 iirc

buoyant viper
fathom cobalt
#

Segoe UI yeah

echo granite
#

Hello, I have the following SQL code:


    private void increaseBy(Player player, String column, int amount) 
    {
        try(PreparedStatement statement = this.dataSource.getConnection().prepareStatement("UPDATE blocks SET " + column + " = " + column + "+1 WHERE uuid = " + player.getUniqueId().toString()))        
        {
            statement.executeUpdate();
        }
        catch(SQLException exception) 
        {
            exception.printStackTrace();
        }
    }```
but when I run it I get the following error: `com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '6fec1162' in 'where clause'`
#

What did I do wrong?

tender shard
#

I reset to default and its JetBrains Mono for me

buoyant viper
#

idk

fathom cobalt
echo granite
#

I want to increase the value of it by 1

buoyant viper
echo granite
#

I'm new to SQL

unreal quartz
#

(also use the prepared statement properly)

tender shard
buoyant viper
#

oh

#

yueah jetbrains mono sounds more right

echo granite
buoyant viper
#

yea

fathom cobalt
young knoll
#

?learnsql

#

Aww

buoyant viper
#

ri

#

p

echo granite
buoyant viper
#

i need a ?learnsql, ive put it off for a long time

fathom cobalt
tender shard
fathom cobalt
# echo granite I know sql.....

but when I run it I get the following error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '6fec1162' in 'where clause'
are you sure? I mean no offense, but this is an SQL error, not a Java error

young knoll
#

I mean they also said they’re new to SQL

#

So I am confusion

unreal quartz
#

I would suggest using the prepared statement properly and setting the strings

fathom cobalt
#

I just never bothered with the fonts πŸ˜›

unreal quartz
#

I can't currently see why else it's broken

echo granite
buoyant viper
#

i like fira mono font

echo granite
#

I don't understand

tender shard
#

UUID.toString

#

should return a normal UUID in string format

young knoll
#

That’s what they are doing

fathom cobalt
tender shard
#

yeah I know

fathom cobalt
#

Baeldung probably have a few

buoyant viper
#

what doesnt that websiteh ave

young knoll
#

Free Peanuts

buoyant viper
#

im allergic

young knoll
#

Well more for me then

buoyant viper
#

one mans trash is another mans treasure

fathom cobalt
#

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '6fec1162' in 'where clause'
also this looks like it's looking for a column by the name of the first part of your uuid (first part being letters/number until first -)

unreal quartz
echo granite
#

thank you very much!

quaint mantle
fathom cobalt
#

same way as an online one I think

#

difference is Player vs OfflinePlayer

young knoll
#

Yep

quaint mantle
#

ah, getofflineplayer

buoyant viper
#

is it worth using hasPotionEffect or should i just do a null check against the effect i want to test for

#

since i then want to use the result from getPotionEffect

young knoll
#

Assuming it’s nullable I’d just do that

#

Similar to map.get

golden turret
#

i would use hasPotionEffect if i wont use the potion

quaint mantle
#

the jvm should allow primitives in type specifiers only when defaults are allowed

golden turret
#

???

quaint mantle
#
Map<String, int; 4> mapOfInts = new HashMap<>();
#

instead of get() returning null

#

it would be the default specified

#

in this case 4

golden turret
#

does the map have default values like that??????

quaint mantle
#

but not primitives

golden turret
#

wtf

quaint mantle
#

cmon im genius

golden turret
#

never saw that

quaint mantle
#

not real

golden turret
#

a

buoyant viper
#

computeIfAbsent / putIfAbsent instead of get tbh

quaint mantle
#

actually it should use ':'

golden turret
quaint mantle
#
Map<String, int : 4> mapOfInts = new HashMap<>();
golden turret
#

Integer

#

gg

quaint mantle
#

not primitives

buoyant viper
#

combattually transmitted diseases are a go @young knoll

buoyant viper
#

yes

#

or CTIs

quaint mantle
#

minecraft stds

young knoll
#

Hunger hands sounds like a good band name

buoyant viper
#

lol

#

i couldnt think of a name for the hot hands so i just called it human torch, like the fantastic 4 guy

#

oh my god wait

#

hot hands

light parcel
young knoll
#

Yep

#

There are spigot wiki pages on it

light parcel
#

Nice, must've missed them, very useful feature!

golden turret
#

i always use that

brave sparrow
#

@quaint mantle that would be tricky given how the JVM handles generics, right now the class is just compiled as if it was Object, versus how C++ does it where for each template type a different version of the class is compiled