#help-development

1 messages · Page 1766 of 1

quaint mantle
#

I'm using it because I'm sharing the plugin with others

#

and I have a licensing system built in

#

just trying to make sure people don't remove the licensing

#

They will even with obfuscation if they want to

#

as the plugin uses a subscription model, as I provide api etc

#

yes but it's harder..

onyx fjord
lavish hemlock
#

Tbh I don't care about obfuscation.

onyx fjord
quaint mantle
#

not really.. unless you do license check everywhere which is definetly just trash in code

quaint mantle
onyx fjord
#

If somebody wants to bypass it theyll do it

quaint mantle
#

duh, but ya know..

onyx fjord
#

subscription model for a plugin...

#

Subscriptions arent allowed on spigot i think

#

are they?

lavish hemlock
#

I wanna bypass it just for fun and to prove a point, but I dunno if that's exactly guideline-safe.

quaint mantle
#

not on spigots website

#

but I'm not posting it on the website

onyx fjord
quaint mantle
#

not posting it on the website

#

again

lavish hemlock
#

oh fun

quaint mantle
#

i know the tos

onyx fjord
#

why ask on our discord then

quaint mantle
#

¯_(ツ)_/¯

lavish hemlock
#

Spigot-related project, why not consult Spigot?

#

Like

#

Where else are you going to go?

#

"The Discord for people who don't know how obfuscation works"?

onyx fjord
#

Mcm4r***

lavish hemlock
#

Good luck trying to find a server that specific.

quaint mantle
#

dude

#

this is for spigotapi

#

nopt for the spigotmc website

#

sooo

#

i'm using spigotapi

#

but not gonna publish it on spigotmc

onyx fjord
#

i dont think spigot api lets you obfuscate your code 😉

#

itself ofc

#

If you really want waste your money on obfuscator and obfuscate your java program

quaint mantle
onyx fjord
#

I dont see how connected it is with spigot api

quaint mantle
#

it sure does

onyx fjord
lavish hemlock
#

GPL 3 requires you give source if requested.

onyx fjord
#

yeah that itself breaks your subscription model

lavish hemlock
#

And you cannot sublicense or relicense or whatever, you must license under GPL 3 if you use a project that is licensed under GPL 3.

onyx fjord
#

under the same license

lavish hemlock
#

You could obfuscate your binaries, but you still have to provide source if asked.

quaint mantle
#

smh..

onyx fjord
#

Feel free to obfuscate binaries yea

lavish hemlock
#

So, there wouldn't really be a point.

onyx fjord
#

also feel free to sell them

#

but source code is something different

#

doesnt gpl say that if you contribute to the project you get copyrights?

#

patent rights*

quaint mantle
#

dope

onyx fjord
#

cool dont post that shit here

quaint mantle
#

if someone else needs help with it

#

they now also have the solution

#

calm your damn voice and stop giving this aggressive tone.

onyx fjord
#

Theres no voice, this is chat, how do you know how aggressive my tone is?

quaint mantle
#

Have a good day.

lavish hemlock
#

Some people can pick out tones even from text.

onyx fjord
#

If you are worried about my tone feel free to hop on vc

quaint mantle
#

I'm good, have a good day.

lavish hemlock
#

Y'know if this dude gave me an obfuscated binary, I could totally find the line which initializes his licensing :)

onyx fjord
#

^

lavish hemlock
#

Pweeease?

#

I need something to do.

onyx fjord
#

Maow lets do a speedrun

lavish hemlock
#

And I want to prove to you that no matter what protections you make, it is all futile in the end.

onyx fjord
#

Lets get somebody to make a license system in a hello world plugin

#

and we will remove it as fast as possible

lavish hemlock
#

hell yeah

hasty dove
#

VotingPlugin

lavish hemlock
#

wow

#

much original

#

very unique

hasty dove
#

?

tardy delta
#

is there a way to get an online player by name?

#

offline*

quaint mantle
#

getOfflinePlayer

tardy delta
#

with a string as parameter is deprecated

quaint mantle
#

read the deprecation note. Deprecated doesnt always mean doesnt work

#

but imo the deprecation here is absolutely unecessary

tardy delta
#

Persistent storage of users should be by UUID as names are no longer unique past a single session.

quaint mantle
#

are you doing persistent storage?

tardy delta
#

i'm trying to ban an (offline)player from a chatchannel

quaint mantle
#

then just use deprecated method

tardy delta
#

oki

lavish hemlock
#

y'know

#

my code literally

#

GLOWS

#

when you look at it

#

it is that good

#

squeaky-clean

quaint mantle
#

:glow-squid:

lavish hemlock
#

glowsquid 🦑🎆

onyx fjord
#

it doesnt prevent stealing

quaint mantle
#

why do they even post plugin to a english forum...?

onyx fjord
#

there are x deobfuscators

lavish hemlock
#

therefore, either you need access to the original codebase, or you have to be incredibly lucky to get a 1:1 match of the original code

quaint mantle
#

in my own region i get this

#

and when i clone a github repo...

#

it just sad

acoustic pendant
#

do hashmap info get deleted when i restart or reload a server?

lavish hemlock
#

yes

#

store and load from a file if you need it to be persistent

quaint mantle
hasty dove
#

Can some one help me with this

#

I’m not sure what is wrong

worldly ingot
#

I would wrap your https:// links in quotation marks

#

Or, really, all of your URL strings

#

e.g. VoteURL: "https://minecraftlist.org/vote/26109"

manic furnace
#

How can i change the name of a player above his head?

old cloud
#

Does equals(Object) in org.bukkit.Location compare objects or the actual location values? If the latter, does it only compare world, x, y and z or also yaw and pitch?

tardy delta
#

can i compare two players with ==?

manic furnace
tardy delta
#

i just want to check if they are the same

old cloud
lavish hemlock
#

Use == as I don't think multiple instances of one player can exist.

old cloud
#

^ yes

lavish hemlock
#

Using equals would probably do identity comparison anyways, and if not, would be much less efficient.

#

You can also compare their UUIDs, I suppose.

tardy delta
#

yes

silver shuttle
#
            PreparedStatement checkX = connection.prepareStatement("SELECT * from FastTravel WHERE posx >= '" + (posX - distance) + "' AND posx <= '" + (posX + distance) + "' AND world = '" + world + "';");
            sender.sendMessage("SELECT * from FastTravel WHERE posx >= '" + (posX - distance) + "' AND posx <= '" + (posX + distance) + "' AND world = '" + world + "';");
            setX = checkX.getResultSet();
            if (setX == null) {

            }
            else if(setX.next()) {

How comes the else if is always false, even if I input the message i get via sender.sendMessage() in the mysql console and it returns values?!?

#

nvm...

eternal oxide
silver shuttle
#

i needed to do executeQuery, not getResultSet

#

i dunno why it is like that, but now it works

lavish hemlock
#

bc a PreparedStatement is one that is compiled but not executed

#

cache via prepared statements if used more than once as it offers higher performance

tardy delta
#

is

if (Bukkit.getOfflinePlayer(uuid).isOnline()) {
  Bukkit.getPlayer(uuid).sendMessage("something");
}```
the same as
```java
if (Bukkit.getPlayer(uuid) != null) {
  Bukkit.getPlayer(uuid).sendMessage("something");
}```
?
eternal oxide
#

no

tardy delta
#

whats the difference?

quaint mantle
#

getplayer... only return if the player is online..? while the getofflineplayer do both i think

eternal oxide
#

nm, it is, I was wrong in assuming the getOfflinePlayer could return null. It can;t

tardy delta
#

ah oki thanks

manic furnace
#

How can i change the name of a player above his head?

eternal oxide
#

scoreboards

manic furnace
#

I mean with packets sry

sharp bough
#

the guy has a lan connection to the server or smth

quaint mantle
#

welp

#

but that 1ms is only in my country

#

other country ping = garbage...

#

Hey there! What's the equivalent of Bukkit.dispatchCommand on bungee? I want to perform a command on the bungee console

quaint mantle
#

But why packets?

quaint mantle
#

Hi, I'm starting to make a plugin for my server and the plugin is based on roleplay (Something like FiveM). As this is my first time starting one I would like to see if anyone is willing to help me

crimson terrace
sharp bough
#

?learnjava

undone axleBOT
sharp bough
#

and watch the tutorials from TheSourceCode

tardy delta
#

wew this is awesome

manic furnace
quaint mantle
#

Thanks

sharp bough
crimson terrace
hasty dove
#

[16:08:42 ERROR]: [null] Votifier was not able to bind to /0.0.0.0:2575

#

This appears even tho my port is open

tardy delta
sharp bough
quaint mantle
#

(adventure noises)

sharp bough
eternal oxide
tardy delta
#

uhh i color my components with chatcolor.translateshit

quaint mantle
#

that sucks!

#

Use TextComponent.fromLegacyText at least

tardy delta
#

👨‍🚀

#

i still need to color it so i guess that would be the same

crimson terrace
#

that looks awesome, saved.

quaint mantle
#

What does utils.colorize do

tardy delta
#
public static String colorize(String args) {
        return ChatColor.translateAlternateColorCodes('&', ChatColor.GRAY + args);
    }
#

):

quaint mantle
#

Use fromLegacyText

tardy delta
#

heh?

#

ah that method

#

i dunno if it would be easy to append event and stuff then

quaint mantle
#

no

#

it'd be even easier

#

And why do you set the eventa to null at the end

silver shuttle
#

How do I read a JSON value from MySQL into a JSONArray?

tardy delta
#

otherwise the event would also be on"to create a home at your..."

ivory sleet
#

Or parse rather

silver shuttle
#

so I read the json as a string, how do I turn it directly into an iterable array?

#

unless I could just replace the ] at the end with the value i want to append

#

😂

ivory sleet
#

Uh well I don’t think there’s such a type like JSONArray JSONObject and so on

#

That’s for nosql and unstructured data stuff

silver shuttle
ivory sleet
#

Don’t use json simple

#

It’s outdated

lavish hemlock
#

then what the fuck do I use

#

I mean what

#

I'm totally not using json-simple in a project I'm working on rn

ivory sleet
#

Any other json lib beats it gson, moshi or even Jackson?

lavish hemlock
#

nope

#

well I need something with streaming

#

I have to parse some giant files

#

but I also need to ignore like 80% of the data within them

#

(I also need to replace the other 20% of that data with my own data)

#

so y'know, injecting data into JSON files in an efficient manner basically

silver shuttle
#
setX.getString("bound").replace("]", ", \"" + player.getUniqueId() + "\"]");

I am just using this now ^^

ivory sleet
lavish hemlock
#

Alright well I dunno how to stream with something like Gson or Jackson.

#

Especially since their APIs are super fucking complicated.

ivory sleet
#

Yeah Jackson’s api is a bit enterprisy

#

Though Gson and moshi aren’t that overhauled

quaint mantle
paper viper
#

but idk if the speed is necessary

quaint mantle
#

I Wonder why does moshi use annotations instead of good ol interfaces

ivory sleet
#

For?

quaint mantle
lavish hemlock
#

bc it's Square

#

they make the weirdest of decisions

#

and then ship it as production code

tranquil viper
#
    public void onSpawn(PlayerRespawnEvent event) {
        if(!plugin.getAngelEvent()) return;
        Player player = event.getPlayer();
        player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1));
        player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 1));
        System.out.println("added");
    }```

Seems to print "added" to console but doesn't actually give the effects, anyone know why?
quaint mantle
#

Annotations modern smort

ivory sleet
lavish hemlock
#

I mean you can still do that with interfaces

ivory sleet
#

Demonstrate an example?

lavish hemlock
#

no

#

because I am tired

#

but I know for a fact interfaces allow stuff like that

opal juniper
#

lol

#

take his word conclure

ivory sleet
#

Pretty sure Gson doesn’t allow you to specify something else than a JsonReader/JsonWriter for TypeAdapter but feel free to prove me wrong

#

Guess you could have something like interface TypeAdapter<T,R,W> but that’s going to make the api design complicated unnecessarily.

opal juniper
#

X,Y,Z > T, R, W

ivory sleet
#

¯_(ツ)_/¯

tardy delta
#

is it worth making something static if there is only one instance of that class?

ivory sleet
#

No not really

tardy delta
#

oki

left swift
#

it is possible to add jvm arguments when starting the plugin?

quaint mantle
#

why

ivory sleet
left swift
#

I have a java module problem in my plugin, the only thing that helped now is adding the --add-opens=java.base/java.lang.reflect=ALL-UNNAMED flag on server startup, I don't have any idea how can i fix that. Problem: module java.base does not open java.lang.reflect to unnamed module (jdk 16)

quaint mantle
#

whats the x/y here? what do you need from java.lang.reflect

left swift
#

i need to set any default attributes for my own entity

#

someone recommended me this way

quaint mantle
#

wtf

left swift
#
        try {
            var lookup = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup());
            final VarHandle MODIFIERS = lookup.findVarHandle(Field.class, "modifiers", int.class);
            final Field field = AttributeDefaults.class.getDeclaredField("b");
            MODIFIERS.set(field, (int) MODIFIERS.get(field) & ~Modifier.FINAL);
            field.setAccessible(true);
            Map<EntityTypes<?>, AttributeProvider> attributes = new HashMap<>((Map<EntityTypes<?>, AttributeProvider>)field.get(null));
            attributes.put(type, EntityInsentient.w().a());
            field.set(null, attributes);
            field.setAccessible(false);
        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
            e.printStackTrace();
        }```
ivory sleet
#

Isn’t there api for this? lol

quaint mantle
#

why use reflection?

#

nms is there and bukkit is your friend too...

left swift
#

I tried to use getDeclaredField on Field.class but in jdk 16 it is not possible

ivory sleet
#

On which field?

#

Oh yeah

left swift
#

modifiers

ivory sleet
#

Java internals are being encapsulated to make it more secure

left swift
#

so i use VarHandle to that

#

and now i have java module problem

ivory sleet
#

Yes

#

I mean maybe unsafe would still allow these operations

quaint mantle
#

(there's Attributable#registerAttribute on paper)

ivory sleet
#

Anyways Tusoo

#

This field in the Attributes class

#

Is it just private final?

left swift
#

yup

#

private static final Map<EntityTypes<? extends EntityLiving>, AttributeProvider> b;

ivory sleet
#

Pretty sure setAccessible overrides it’s final state for reflective operations

#

At least it did on some jdk versions I believe

#

Oh it’s static

#

nvm

left swift
#

so maybe there is some other option how can i fix this problem or set the attributes in a different way?

serene trench
#

how to solve it

tranquil mango
#

How can I open a sign and get player input?

chrome beacon
#

NMS and Packets

tranquil mango
#

There is a openSign function for players

#

But you can't get input with that though, can you?

chrome beacon
#

That would be Paper or some other fork

tranquil mango
#

Ah

#

Yes

#

I forgot I was using Paper :)

quaint mantle
tranquil mango
#

Why not?

quaint mantle
#

thats inconvenient for user + harder to maintain

#

chat is the best way, believe me

stone sinew
#

He could be making editable signs

tranquil mango
#

^^^^

quaint mantle
#

ah then sorry

#

i just spent a lots of time on packet based anvil n sign guis, and, as result nothing but annoyed players

stone sinew
quaint mantle
#

they are fully clientside starting from 1.8 iirc

stone sinew
quaint mantle
#

Pretty sure its not

#

it was in 1.7, but not now

stone sinew
#

I've seen it in 1.14

quaint mantle
#

and its being sent by client, on command block update

tardy delta
#

should i store a static cache of instances in its class or at some other place?

quaint mantle
#

no

#

well, depends on context

tardy delta
#

i'm keeping a cache of chatplayer objects

#

like with lists that store the channels they are in

quaint mantle
#

then make ChatPlayerManager class or smth

tardy delta
#

another class..

quaint mantle
#

yes, whats the problem?

#

single responsibility principe 🤓

tardy delta
#

that it will only have one method

#

and a map

quaint mantle
#

ok

lavish hemlock
#

eh never personally enjoyed SRP

#

probably one of the worst aspects of OOP bc of classloading overhead

tardy delta
#

what is srp?

lavish hemlock
#

and also how code can sometimes get messier from an abundance of classes

#

Single Responsibility Principle

tardy delta
#

ah

quaint mantle
#

you, like, dont do a seperate class for every function, but the ChatPlayer itself shoudlnt manage players

lavish hemlock
#

fair

#

CLASS GO BRRRRR

quaint mantle
tardy delta
#

lets make everything static 🤓

quaint mantle
#

srp is absolutely fine and reasonable aspect

lavish hemlock
#

congratulations, you are now a pure imperative language

#

whatever that means

#

I don't think such a thing even exists

#

but like making everything static means you have no state

quaint mantle
#

you can go to the pascal or idk with this thoughts

tardy delta
#

static states 🌝

#

or just no cache

lavish hemlock
#

no cache

performance go 📉 📉 📉 📉 OH SHIT

tardy delta
#

in fact its just this

lavish hemlock
#

computeIfAbsent

tardy delta
#

what does that do?

#

immediatly return it?

#

with a function to add it

lavish hemlock
#

it will:

  • check if a value exists in the map
  • if it doesn't, it will call a lambda you have passed to it
  • it will set the key to the new value from that lambda
  • if the value did exist, return it, if it didn't, return the lambda's value
#

it's much more efficient and is a single line

#

lambdas are nice bc they're lazy, they only execute when necessary

#

you can use it like

#

return playerCache.computeIfAbsent(uuid, (key) -> new ChatPlayer(this, uuid));

tardy delta
#

the lambda takes a parameter

lavish hemlock
#

oh ye that's the key

#

lemme just edit my message

tardy delta
#

what is the key in the lambda though?

lavish hemlock
#

it's also conventional to use the parameter name ignored if it is unnecessary for that lambda

tardy delta
#

oh

lavish hemlock
#

the one passed to computeIfAbsent

#

the first param

echo basalt
lavish hemlock
#

afaik ChatPlayer isn't actually a Player

#

it's just a wrapper around player stuff

tardy delta
#

uhu

lavish hemlock
#

sooo there shouldn't be a memleak

echo basalt
#

yeah but how often is that cache wiped

#

You're gonna end up like Jobs that caches all blocks for anti-dupe purposes and never wipes the cache

tardy delta
#

ah shit

graceful oak
#

Is is possible with the BlockBreakEvent to check which side of the block you broke it from?

echo basalt
#

consumed 5gb on my survival server before I forked it and started wiping it some times

tardy delta
lavish hemlock
echo basalt
#

If that doesn't exist, cache the last clicked block face via PlayerInteractEvent

lavish hemlock
#

actually it makes a small difference

quaint mantle
lavish hemlock
#

oh right

echo basalt
#

I usually put the parentheses for readability

rancid pine
#

I don’t understand json files, how do they work?

echo basalt
#

helps me understand where it stards

lavish hemlock
#

but ye the method generated by the compiler for that lambda will have an additional parameter if you capture outside variables I believe?

echo basalt
graceful oak
# echo basalt event.getBlockFace ?

Well what it lets me do is e.getBlock.getFace() but then requires a block argument which doesnt make sense to me because the block is already being given

echo basalt
#

LivingEntity#raytraceBlocks

#

It returns 2 blocks

#

get the face relative to one another

tardy delta
lavish hemlock
echo basalt
#

Which is about as accurate as it gets

lavish hemlock
#

what I'm saying is

#

lambdas are actually compiled to be methods in the same class

echo basalt
#

Huh

tardy delta
#

learning new things today

lavish hemlock
#

when capturing a variable outside of the lambda, it must add a new parameter to that method

echo basalt
#

Thought lambdas made an anonymous internal class

lavish hemlock
#

nah I actually have no idea how it does that

#

probably some invokedynamic magic

echo basalt
#

ClassNameHere$1#someMethod(ClassType object, ClassType2 object2)

lavish hemlock
#

one sec

echo basalt
#

A lambda just makes an anonymous class

#

An anonymous class is just an internal class with a $<number> in bytecode iirc, that implements the method

#

lambdas are fun

lavish hemlock
#

Don't use the term "anonymous class," it's actually used by MethodHandles.Lookup to refer to classes that cannot be found by the classloader iirc.

#

Plus, that's not true.

#

afaik

echo basalt
lavish hemlock
#

Lemme look at the bytecode.

#

oh right those

#

yeah those are just inline class implementations

echo basalt
#

They're called Anonymous classes according to Oracle

lavish hemlock
#

that's bc they can't be referred to

echo basalt
#

....

quaint mantle
#

lambdas work different from Anonymous classes

echo basalt
#

Lambdas seem to be based on Anonymous classes

#

The parameters end up on the left side of the lambda

#

The return value is the same as the anonymous method

lavish hemlock
#

so let's take the class

import java.util.function.Consumer;

public class CompiledLambda {
    public static void main(String[] args) {
        final String other = "fuck";
        final Consumer<String> c = (s) -> {
            System.out.println(other);
            System.out.println(s);
        };
    }
}
echo basalt
#
public void doSomething(Object one, int two, String three) {
  return three.length() + two + one.hashCode();
}

gets converted to

(one, two, three) -> three.length() + two + one.hashCode()
tardy delta
#

string fuck 🤓

lavish hemlock
#

lambda$<declaring method>$<lambda index>

#

it is this way to avoid conflicts

#

and also provide better debug information, I presume

#

but right here is where that Consumer is created and stored

#

#0 referring to bootstrap method 0, which points to

#

a LambdaMetafactory.metafactory call which will return a Consumer for that lambda method

#

(that's public API btw, fun fact)

#

you can see by the second method argument that it references lambda$main$0

old cloud
#

Can someone explain this? 🤨

lavish hemlock
#

that is specifically a method handle embedded in the constant table of the class that references the lambda method

#

so yeah

#

I believe metafactory actually creates a Consumer that calls the method?

#

but I don't know, I haven't looked into it

#

✨ Exploring the JVM with Maow ✨

#

anyway that's also why lambdas are pretty fast

#

they're literally just dynamic method invocations

quaint mantle
#

you can replace reflection with lambdametafactory

#

thats cool

lavish hemlock
#

if you know all the types

#

it's also hard to work with

quaint mantle
#

well, Class.forName is our friend

lavish hemlock
#

but one thing you can't do with LambdaMetafactory is loop through all methods in a class

#

or access fields

quaint mantle
#

like, if you know exact method you need you may use it

lavish hemlock
#

and you'd have to have functional interfaces for each possible method type

#

(my solution? classloader hacks + class generation, haven't tested it yet but it would be fun)

#

(you would have to declare the class on the Lookup you use for the metafactory)

#

but yeah LambdaMetafactory is fast

#

it is about as fast as direct access

#

you have basically 3 reflective options:

#

Reflection - Fast lookup, slow invocation, good for one-time operations.
MethodHandle - Slow lookup, fast invocation, great when caching commonly-run methods. (I have had some struggles with private methods in the past though, look out)
LambdaMetafactory - Fast lookup, fast invocation, makes code harder to read/work with, but is a good tool if you have a performance-tight application.

#

(Technically metafactory is internal-ish API, since it's used by the JVM to retrieve functional interfaces for lambda methods, but is required to be public due to access restrictions)

#

anyway sorry for the ramble I just love talking about bytecode and shit

tardy delta
#

i like foodies

#

😐

subtle folio
#

If i use .setHealth(0); whilst the player is in a fight, does the attacker still get the kill?

unkempt peak
#

I don't think so

#

Haven't tested it though

subtle folio
#

rip

#

is there any way of doing so

unkempt peak
#

What exactly are you trying to do?

subtle folio
#

i have a OnDeath listener for way 2 players fight stuff happens, im trynig to check if their y is below a certain coord and if it is, they die

#

kinda like a sumo duel

unkempt peak
#

Ah ok

eternal oxide
#

Use the above method, passing their health and teh other player as the entity

old cloud
#

Anyone knows why entities do not despawn when I remove them in onDisable?

ivory sleet
#

Might be cause onDisable runs on the last tick

old cloud
#

What can I do?

#

runTaskLater?

#

Like, call the remove() method and then do runTaskLater with no content

eternal oxide
#

no

old cloud
#

Ok

eternal oxide
#

you can;t use teh scheduler in onDisable

old cloud
#

ok

eternal oxide
#

onDisable is so your plugin can clean up after itself, not make changes to the world

old cloud
#

Yea alright, but I still need to remove entities

meager grove
#

Hi i just downloaded a Plugin on Spigot and there is a error when the Plugin tries to load. Could not load 'plugins/randomitem-1.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.17. But do i really need to update my Server Version to 1.17 ? Is there any other way ? I am using 1.16

old cloud
quaint mantle
#

update your server (recommended) or find a 1.16 compatible version

ivory sleet
tardy delta
#

"technically"

old cloud
#

Basically, I just want to remove armor stands because they obviously lose their metadata so I can't use them after a restart.

meager grove
unique ingot
#

Hey does multiverse prevent entities from spawning in the overworld in 1.17.1?

#

whenever i use the exit portal in the end

graceful oak
#

if I have a few blocks can i just initialize a list with the blocks or do i individually have to add each block after initializing it

eternal oxide
#

Your question is very vague

#

You can add blocks to a list at any time

#

depending on how you create the list

graceful oak
#

I dont know how to word it so like I am recording a ton of blocks as variable and I want to make a list of them can i just make an arraylist and put them all in while initializing it in one line or after I make the arraylist do I have to add them one by one with arraylist.add

eternal oxide
#

either is fine

crimson terrace
eternal oxide
#

if you are adding Blocks you may be better using a Set over a List

graceful oak
#

How do I do it when initializing it I cant seem to find the correct format for it

crimson terrace
#

Lists (especially very long ones) can be hard to find stuff in and add stuff to

eternal oxide
#

attributes

foggy estuary
#

okt y

crimson terrace
#

edit the max health in the attributes and then dont forget to set the actual health to the max health

old cloud
#

Also, could it be that you cant spawn entities in onEnable?

crimson terrace
#

you can. I just delay it a bit so theres no trouble

old cloud
#

I delayed it 40 ticks and it did nothing

crimson terrace
#

40 ticks might not be enough. I did 5 or 7 seconds

#

depending on how long the server takes to start up it could be different

old cloud
#

nice

#

Means I can never be sure if the entities actually spawned or not

crimson terrace
#

ive never had any reports of it not working. lemme get my numbers

#

this works for me. try it maybe

old cloud
#

What is the difference between runTaskLater and scheduleSyncDelayedTask?

crimson terrace
#

I believe for runTaskLater you have to tell it when to run it at one point

#

not sure tho

eternal oxide
#

they are effectively the same

crimson terrace
#

nvm me then, sorry

eternal oxide
#

both have a delay

old cloud
#

btw it didnt spawn

crimson terrace
#

there could be a different reason other than the delay

#

how about you send the code in a ?paste and we look at it with you?

eternal oxide
#

I believe it was when they resolved the confusing naming of the async scheduling the runTaskLater was added

old cloud
crimson terrace
#

send the relevant bits

old cloud
#

And I would need to send like 10 methods

crimson terrace
#

gotta start somewhere, dont we? 🙂

old cloud
#

yea

#

?paste

undone axleBOT
ember estuary
#

Can someone help me fix my code?

Trying to display the Hardcore Death-screen (Spectate World | Title Screen) after someone dies. Without the difficulty actually being hardcore.

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e) {
        ((CraftPlayer) e.getPlayer()).getHandle().b.sendPacket(new PacketPlayOutServerDifficulty(EnumDifficulty.a, false));
    }

But it just doesnt display the Hardcore Death-screen.

#

But afaik know, the Event is triggered BEFORE the player actually dies, so idk why it doesnt work

eternal oxide
#

You would have to do it before they actually die

#

in the damage event

ember estuary
#

doesnt the death event trigger before?

eternal oxide
#

once the death event runs they are already dead

ember estuary
#

oh

crimson terrace
#

cant be dead if you havent taken damage 🙂

ember estuary
#

i see

quasi flint
#

U can calculate the damage

ember estuary
#

what does cancelling the death event do? nothing? Unrelated, but just wondering

quasi flint
#

In the damageevent

eternal oxide
#

you can generally tell when events trigger. If they are cancelable, they run before. If not they run after

quasi flint
#

If its fatal Display screen

ember estuary
#

But its cancellable

eternal oxide
#

no its not

ember estuary
#

how can i see?

ember estuary
#

thats weird, in my code i can do e.setCancelled(true); without a problem

crimson terrace
eternal oxide
#

I'm going to bet you are not running spigot then

ember estuary
#

oh, paper changes stuff?

crimson terrace
#

spigot runs on paper tho

ember estuary
#

literally everything is the same tho

old cloud
ember estuary
#

besides this one detail

crimson terrace
ember estuary
#

i see

#

which dont work and confuse me, great

#

how can i calculate if the player is about to die?
in the damage event just check his healt, subtract the damage, and if below 0 thats it?

crimson terrace
quasi flint
#

Because He Sets IT Not visible

crimson terrace
quasi flint
#

setVisible(false)

old cloud
crimson terrace
old cloud
#

let me try

crimson terrace
#

it could just be the this.display being null or something

old cloud
#

Okaay

#

The armor stands actually do spawn

crimson terrace
#

good 🙂

old cloud
#

wrong react

#

Now the weird thing: If i do /reload everything works fine

crimson terrace
#

If you send more code I can help you better i believe

#

so if you reload the display name shows?

eternal oxide
#

Use the world.spawn with the consumer

old cloud
#

If I reload, the holograms despawn, and spawn again and are actually linked to my functionalities. If I restart the server it only spawns and stacks because the old one didnt despawn

eternal oxide
#

that way you set all teh custom name etc before its put in the world

crimson terrace
old cloud
#

Bruh

crimson terrace
#

maybe tag their scoreboardTags

old cloud
#

That obviously doesnt work

crimson terrace
#

why not?

old cloud
#

Because they are not removed

crimson terrace
#

cant know you already did that

old cloud
#

Thought you read the earlier stuff in this chat

crimson terrace
#

you could add them to a list and onDisable() do a for(:) for that list removing those entities

old cloud
#
        for(InfBlock b : infBlocks) {
            b.saveTo(blocks);
            b.getHead().despawnAll();
        }
eternal oxide
#

This way you make all teh changes before they are added to the world and your custom name shoudl show

old cloud
#

no wait

#

It does spawn and show and everything, but the armor stands are desynced with my plugin

eternal oxide
#

old stands or teh current spawned ones?

#

If you are having problems with old stands you should implement a session key to each

old cloud
#

Ok so the new armor stands are spawning, even without delay

#

BUT, yea, old ones are also not removed when the server shuts down

eternal oxide
#

when yoru plugin starts up, generate a random key (UUID.random()) or something of that sort.

#

Store that key in teh PDC of any stand you spawn.

old cloud
#

whats pdc

crimson terrace
#

PersistentDataContainer

#

its really useful

eternal oxide
#

then in the spawn event check the stand for teh key, if it has a key of the wrong value delete the stand

#

?pdc

eternal oxide
#

that way you'll remove any old stands and only spawn ones with the correct session key

old cloud
#

Wait so pdc is like metadata but is not gone when the server shuts down?

eternal oxide
#

yes

crimson terrace
#

yes

old cloud
#

Bruh, why did I not know that 🙁

crimson terrace
#

I use it for special Items that do stuff on click, coordinates for mobs to respawn and so on

left swift
#

How can I set default attributes for my custom entity? Currently I use that code, but that causes java module problems

    private static <E extends Entity> void setDefaultAttributes(EntityTypes<E> type){
        try {
            var lookup = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup());
            final VarHandle MODIFIERS = lookup.findVarHandle(Field.class, "modifiers", int.class);
            final Field field = AttributeDefaults.class.getDeclaredField("b");
            MODIFIERS.set(field, (int) MODIFIERS.get(field) & ~Modifier.FINAL);
            field.setAccessible(true);
            Map<EntityTypes<?>, AttributeProvider> attributes = new HashMap<>((Map<EntityTypes<?>, AttributeProvider>)field.get(null));
            attributes.put(type, EntityInsentient.w().a());
            field.set(null, attributes);
            field.setAccessible(false);
        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }```
eternal oxide
#

attributes are accessible within the API now

crimson terrace
#

entity.getAttribute() is what I use

#

and then set the base value if you wanna change the max hp

eternal oxide
#

why are you trying to reflect into private final fields?

old cloud
eternal oxide
crimson terrace
#

and then you check if the stand has that tag in the pdc

eternal oxide
#

if it has a value in the PDC for teh key you set you allow it to spawn

old cloud
#

right, i was dumb

eternal oxide
#

if it has a key but the value is wrong, you remove it

left swift
old cloud
#

Okay, I'll try that 👍

eternal oxide
#

Tusoo you seem to be ignoring us

crimson terrace
#

Tusoo what are you trying to do?

left swift
#

set default attributes for my custom entity

crimson terrace
#

hey elgar can I feed a bit of code?

#

its 2 lines

#

😛

eternal oxide
#

I wont stop you, even if I could 🙂

crimson terrace
#

just asking if you were gonna explain it again

eternal oxide
#

ah

#

ok

crimson terrace
#

entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(someDouble)); sets the max HP of an entity

left swift
chrome beacon
#

It's not

eternal oxide
crimson terrace
#

Tusoo please note the line I gave you. thats all you need to set the max HP of an entity.... then set the current HP aswell so they actually have the HP you want

tranquil viper
#

How do I check if it is raining or thundering in a world? I got thundering but raining I am stumped on

eternal oxide
#

if its not clear, its raining

#

I believe

#

hasStorm() tells you if its raining/snowing

tranquil viper
#

hasStorm() doesn't work if its raining

eternal oxide
#

it should

tranquil viper
#

Well I must be doing it wrong then

#

if(!player.getWorld().isThundering() || !player.getWorld().hasStorm() return;

eternal oxide
#
setStorm
void setStorm​(boolean hasStorm)
Set whether there is a storm. A duration will be set for the new current conditions. This will implicitly call setClearWeatherDuration(int) with 0 ticks to reset the world's clear weather.

Parameters:
    hasStorm - Whether there is rain and snow

tranquil viper
#

That should work correct?

eternal oxide
#

not if thats the exact code you have

#

missing a )

lyric grove
#

Should i check if a player is null in a task?

tranquil viper
lyric grove
#

I think the player might be null if the player isnt fully logged in?

tranquil viper
#

Depends where you are running the task

#

But no player shouldn't ever really be null

#

Only case I have had it be null is if I am accessing an OfflinePlayer and they have never logged in

lyric grove
#

oh thanks, im running the task every second as its more optimized then using listeners

eternal oxide
#

If you are wanting to check all online players use continue and not return

eternal oxide
#

and 30 ticks is 1.5 seconds

tranquil viper
#

if(!player.getWorld().isThundering() || !player.getWorld().hasStorm()) return; simply does not work

old cloud
#

@eternal oxide @crimson terrace Thanks, the PDC thing works very great :)

eternal oxide
tranquil viper
#

I know

#

oh

#

im stupid

#

I should be using &&

#

not ||

#

cool its working

rough jay
#

How can I do like WorldEdit : select and save temporary two locations that I can use when I do a command that requires the locations?

old cloud
#

And to select it you can use PlayerInteractEvent

silver shuttle
#

under what condition is this null?

crimson terrace
#

probably when it doesnt find the player you give it

eternal oxide
#

are you checkign if a Player is online or an OfflinePlayer is online?

silver shuttle
#

if a player is online

#
                if(Bukkit.getPlayer(newOwner) == null) {
                    sender.sendMessage(getString("messages.transfer.not-online"));
                    return true;
                }
                if(!(Bukkit.getPlayer(newOwner).isOnline())) {
                    sender.sendMessage(getString("messages.transfer.not-online"));
                    return true;
                }
eternal oxide
#

if you have a player object he has to be online

wide coyote
#

player object will be null when player is offline

crimson terrace
#

in that case the getPlayer would return null or an exception right?

silver shuttle
eternal oxide
#

null

#

yes, second one is pointless

crimson terrace
silver shuttle
#

coool

wide coyote
silver shuttle
#

thanks

wide coyote
#

np

crimson terrace
#

basically that is

silver shuttle
#
                if(Bukkit.getPlayer(newOwner) == null) {
                    sender.sendMessage(getString("messages.transfer.not-online"));
                    return true;
                }
                UUID newUUID = Bukkit.getPlayerUniqueId(newOwner);

But this will 100% not cause an error?

wide coyote
#

Bukkit#getPlayerUniqueId???

#

since when

eternal oxide
#

not in Spigot

silver shuttle
#

wait does that not work?

#

not even Paper?

eternal oxide
#

no clue its Spigot here

silver shuttle
#

it is paper

wide coyote
#

it may work in paper idk

silver shuttle
crimson terrace
#

paper methods do not work on spigot

silver shuttle
#

ik

wide coyote
#

but you can simply create a player variable and check its null if not player.getUniqueId()

#

it probably will be faster

rough jay
#

How can I know if the PlayerInteractEvent is a right click or a left click?

wide coyote
# wide coyote it probably will be faster
                Player player = Bukkit.getPlayer(newOwner);
                if(player == null) {
                    sender.sendMessage(getString("messages.transfer.not-online"));
                    return true;
                }
                UUID newUUID = player.getUniqueId();
crimson terrace
#

you can check if the event.getAction() is Action.RIGHT_CLICK_AIR for example

quaint mantle
#

and use == to compare enums

#

not .equals()

crimson terrace
silver shuttle
#

How do I register command arguments as syntax?

quaint mantle
#

wym?

crimson terrace
eternal oxide
#

you only register root commands

crimson terrace
quaint mantle
silver shuttle
crimson terrace
eternal oxide
#

implement TabExecutor instead of CommandExecutor

left swift
wide coyote
silver shuttle
eternal oxide
silver shuttle
#

ok ty

crimson terrace
vocal mirage
#

Hi!
If i have a permission maxamount.1, how can I get the number without knowing what numbers you can be faced to?

Thanks

left swift
crimson terrace
#

what entity were you editing again?

left swift
left swift
eternal oxide
# vocal mirage Hi! If i have a permission maxamount.1, how can I get the number without knowing...
    protected int getEffectivePermIntNode(String playerName, String node) {

        /*
         * Bukkit doesn't support non boolean nodes
         * so treat the same as bPerms
         */
        Player player = BukkitTools.getPlayer(playerName);

        int biggest = -1;
        for (PermissionAttachmentInfo test : player.getEffectivePermissions()) {
            if (test.getPermission().startsWith(node + ".")) {
                String[] split = test.getPermission().split("\\.");
                try {
                    int i = Integer.parseInt(split[split.length - 1]);
                    biggest = Math.max(biggest, i);
                } catch (NumberFormatException e) {
                }
            }
        }
        return biggest;
    }```
#

modify for yoru use

crimson terrace
# left swift I register custom

looking at the code youre making a completely new entity type... i cant really help you with that. I thought you were trying to modify like a spider

#

or am I reading this wrong

left swift
#

correct

silver shuttle
#

how would I add an autocomplete of all online players for a specific one of these commands?

eternal oxide
#

return null

silver shuttle
#

what? No, I mean I want the autocomplete of a specific list for args[0] and if args[0] is "transfer" i want it to give an autocomplete list for args[1] of all online players

eternal oxide
rough jay
#

Bruh it doesn't work

if (player.getItemInHand().getType() == Material.WOODEN_AXE) {
    if (player.getGameMode() != GameMode.CREATIVE) return;
    if (!player.hasPermission("ee.loc")) return;
    if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
        playerManager.setPlayerLocation1(player, event.getClickedBlock().getLocation());
        player.sendMessage(MaxiCity.chat("&aPosition 1 set!"));
    } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        playerManager.setPlayerLocation2(player, event.getClickedBlock().getLocation());
        player.sendMessage(MaxiCity.chat("&aPosition 2 set!"));
    }
}
#

why it doesn't work?

silver shuttle
#

error?

rough jay
#

there's no error

#

maybe the issue is this?
(player.getItemInHand().getType() == Material.WOODEN_AXE)?

silver shuttle
#
Bukkit.getOfflinePlayer(setX.getString("owner")).getName();

Why does this call take 2 seconds?!?!?!?

stone sinew
#

Plus you're using setX.getString("") so it has to get the string every time too.

silver shuttle
#

ah okay, but i am on my own server where 2 people have joined in total xd

stone sinew
silver shuttle
#

nope

#

replaced it with a string and it still takes 2s

stone sinew
#

Is your server lagging then?

silver shuttle
#

no

#

100% not

stone sinew
#

IDK then. You timed it and it took 2 seconds or did another point in your code take 2 seconds?

silver shuttle
#

i removed it and it was instant

stone sinew
#

Yeah IDK then Try looking through the source code.

sullen marlin
#

if the player hasnt joined it has to ask mojang for their uuid

#

thats why the method is deprecated, it says this in the docs

silver shuttle
silver shuttle
sullen marlin
#

use uuid not name

stone sinew
silver shuttle
sullen marlin
#

isnt getString(owner) their name?

silver shuttle
#

no, i store the uuid

eternal oxide
#

uuid as a string?

sullen marlin
#

then use getOfflinePlayer(UUID)

#

UUID.fromString or whatever

silver shuttle
#

but thats what I was using until now

ember estuary
#

I have the command "/challenge start" to run a function.
After someone ran it manually once, it should always run by itself at server start.

I guess for this to be possible, i have to save in a file, if someone ran the command. Right?

Whats the best way to do this? Make a config? Make a yml file? make a text file and at server start check if it exists? or is there any easier way to do it?

vagrant heron
#

where can i find download for bungeecord.jar for 1.17+

silver shuttle
vagrant heron
silver shuttle
ember estuary
#

ah, so just use the config file as a boolean?
Exists -> run function
Doesnt exist -> dont run funciton

silver shuttle
#

yup

ember estuary
#

not a bad idea, thanks

proud basin
#

Anyone know how I can detect if someone tries to force op?

ember estuary
#

does that even still work in 1.17 ?

#

you can check the command-sender, and if its console its probably forceop

#

unless you op people via console

rough jay
#

I don't understand

tranquil viper
#

^

young knoll
#

Forceop from hacked clients was patched long ago

rough jay
#
area:
    description: Manages areas
    usage: /area <new:remove:set:add:info> <name> [<owner:coowner>] [<player>]
    permission: ee.area
    permission-message: &cYou do not have permission to execute this command!
young knoll
#

Did you set up a tab completer

proud basin
rough jay
young knoll
#

implements tabCompleter

ember estuary
#

forceop as i know it always uses an exploit to make the console run the op command. so yeah, probably the only way to check if the console runs the command

rough jay
silver shuttle
tranquil viper
#

Just check if console runts the op command and then if it does then ban the person that was opped

young knoll
#

I'm almost certain no force op exploit exists on online 1.17 servers

silver shuttle
# rough jay in my command class?
    @Override
    public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
        List<String> lis = new java.util.ArrayList<>(Collections.emptyList());
        lis.add("help");
        lis.add("create");
        lis.add("bind");
        lis.add("unbind");
        lis.add("delete");
        lis.add("lock");
        lis.add("transfer");
        lis.add("info");
        return lis;
    }
tranquil viper
#

same

silver shuttle
#

like that ^^

ember estuary
#

You can use Lambdas

young knoll
#

Show me one

ember estuary
#

getCommand("yourcommand").setTabCompleter((commandSender, command, s, args) -> {
if (args.length == 1) return ...
else return ...
});

hybrid spoke
#

the simplest one would be an injected plugin

#

bungeecord exploits

#

iirc there was one with mojangs authentication servers

young knoll
#

That isn't what I was talking about though

hybrid spoke
#

exploits never dont exist

young knoll
#

I specifically said hacked clients, not backdoored plugins

hybrid spoke
#

still not impossible

sullen marlin
young knoll
#

There was one

ember estuary
young knoll
#

With written books / signs

hybrid spoke
#

the player clicked did

silver shuttle
#

How do I add a different TabComplete list for each argument, depending on the previous argument? Like a tree

echo basalt
#

For some reason registering commands via the command map doesn't really work 100% 🤔

young knoll
#

Check the length of the args array

echo basalt
#

The command still runs but tab completion is weird

sullen marlin
#

exactly that, a tree

silver shuttle
ember estuary
hybrid spoke
silver shuttle
#

ok ty

hybrid spoke
#

String[] args doesnt exist for nothing

silver shuttle
#

alr ty

ember estuary
#
getCommand("yourcommand").setTabCompleter((commandSender, command, s, args) -> {
  if (args.length == 1) return Arrays.asList("firstcompletion", "firstcompletionalternative");
  else if (args.length == 2) return Arrays.asList("secondcompletion", "secondcompletionalternative");
  else return Collections.emptyList();
});

Tree. thats how.

echo basalt
echo basalt
#

My comparisonresult classes handle args but that's about it, I left the base command to be completed by bukkit, as registering a command via plugin.yml + getCommand method handles label completion

#

🤔

ember estuary
#

TabCompleter is an interface

#

But yeah, just use lambdas, way simpler

hybrid spoke
ember estuary
#

Ah, that's how, i was wondering, thank you!!

quaint mantle
#

Daily reminder varargs is a thing

ember estuary
#

whats that

hybrid spoke
#

instead of Arrays.asList(new String[] {""}); -> Arrays.asList("string", "string2");

ember estuary
#

ah. String... values

#

wait, that works?

hybrid spoke
#

sure it does

ember estuary
#

wow, thanks, didnt know that

#

thats great

echo basalt
#

Guess I'll go screw myself over my oddly specific issue

quaint mantle
#

Also you may re-use those lists

#

Make a constants instead of creating new lists everytime

ember estuary
#

idk if its worth that liiiiittle performance boost to write more code

#

its not imo,
but still a good point, yeah, could do that

quaint mantle
#

Just use a command framework smh

ember estuary
#

whats that

#

this is my first ever plugin, so sorry if im new to stuff

tranquil viper
#

command frameworks are completely unnecessary

echo basalt
#

But be careful

hybrid spoke
#

performance boost.. hm, you just dont want to create new objects on every tabcompletion

echo basalt
#

you don't want to end up like CMI which is leaking and crashing my server due to tab completion caching

rough jay
hybrid spoke
echo basalt
#

I hate your code lmao

#

I like to strive for clean code but I look at my code and it isn't beginner friendly

quaint mantle
#

show us your code

echo basalt
#

ehhhh

#

as you wish

#

my latest project, took me an all-nighter

stone sinew
ember estuary
#

Why not use a switch-statement instead of all those
if ( ... equalsignorecase ...)

silver shuttle
quaint mantle
#

lombok

stone sinew
silver shuttle
#

teach me what to use instead

#

because I dont rlly know

echo basalt
#

oh wow I used lombok to avoid pressing alt+insert 25 times and have 500 lines of code at the bottom of a class that no one will look at

quaint mantle
#

Teach yourself

silver shuttle
# quaint mantle Teach yourself

I tried and this is what I came up with. it works. if somebody has a problem with it, I ask them to teach me their method and tell me why theirs is supposedly better

stone sinew
silver shuttle
#

alright, thanks

rough jay
#

?

silver shuttle
#

?!?

ember estuary
#

oh wait ur implementing tabcompleter

#

nvm xD

silver shuttle
#

it works fine lol

rough jay
#

???

ember estuary
#

true xD

ember estuary
#

didnt see that implements

silver shuttle
#

lmao shitStorm incoming

ember estuary
#

if it works fine, where is the problem? xD

silver shuttle
#

floskater99.add(new ShitStorm)

rough jay
#

it doesn't work

silver shuttle
#

it does

ember estuary
#

:D

rough jay
#

no what I did doesn't work

silver shuttle
#

oh lol kk

#

well my stuff works now

hybrid spoke
#

did you register the tabcompleter

ember estuary
#

do args.length == 1 instead of args.length == 0

#

cuz it somehow starts at 1

#

idk why

rough jay
#

?

ember estuary
#

oops

hybrid spoke
ember estuary
#

see now

#

edited

rough jay
hybrid spoke
rough jay
#

why?

ember estuary
#

max
do args.length == 1 instead of args.length == 0

hybrid spoke
#
        getCommand("antiac").setExecutor(new AntiACCommand(this));
        getCommand("antiac").setTabCompleter(new AntiACCommandTabCompleter());
#

you have to set the tabcompleter explicity to the command

ember estuary
#

and set it like that, yea

#

does anyone know why args start with 1?

rough jay
#

it doesn't

ember estuary
#

when i print args its just empty

#

but length gives 1

hybrid spoke
#

they dont, its the length

#

java indexes are 0-based

eternal oxide
ember estuary
#

sure, but args.length is never 0

hybrid spoke
eternal oxide
#

args length of 0 would be an empty args

rough jay
hybrid spoke
#

oh wait misread

#

tabexecutor

hybrid spoke
rough jay
#

public class AreaCommand implements CommandExecutor, TabExecutor

#

like this?

hybrid spoke
#

just implement TabExecutor

#

TabExecutor already implements CommandExecutor

rough jay
#

ok

#

public class AreaCommand implements TabExecutor

#

and I don't have to do this getCommand("antiac").setTabCompleter(new AntiACCommandTabCompleter());

ember estuary
#

in the onTabComplete method you can then just check " if (command.equalsIgnoreCase(...)) ... " for every command

#

i assume. im pretty new, sorry if thats wrong xD

eternal oxide
#

no need, the tab completer will only trigger for teh command its registered with

ember estuary
#

but he doesnt register it

eternal oxide
#

you only need to register the command

ember estuary
#

he wants to have a lot of commands

eternal oxide
#

if you implement TabExecutor, or TabCompleter in teh command class

ember estuary
#

How can I make an array of string lists, and initialize it?

Thats how i'm trying right now:
List<String>[] suggestions = new ArrayList<String>()[]{Arrays.asList("start","stop"), Collections.emptyList()};

arctic moth
#

how do you add the stuff to the pom.xml im not used to maven lol

#

i tried this

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.tristandasavage</groupId>
    <artifactId>Cool Minigames</artifactId>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>16</maven.compiler.source>
        <maven.compiler.target>16</maven.compiler.target>
    </properties>
    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <!--This adds the Spigot API artifact to the build -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
#

but it doesnt seem to work

ivory sleet
ivory sleet
arctic moth
#

idk

#

its not using the spigot api

#

lol im not very used to maven

ivory sleet
#

Have you reloaded your project?

arctic moth
#

but when i try to install it it doesnt work

#

oh

#

wait i have to restart my ide first

ivory sleet
#

alrighty

arctic moth
#

lol

#

yep it works

#

im dumb

foggy estuary
#

How do you set blocks at certain locations to turn into air?

young knoll
#

setType

foggy estuary
#

an example?

gleaming grove
#

@foggy estuary

quaint mantle
#

vscode for java 🤮

#

vscode in general 🤮

gleaming grove
#

i use Intelij 😄

quaint mantle
#

Very good

ember estuary
#

how to delete the config file?

I can use saveDefaultConfig() to create it, but there is no deleteDefaultConfig()

hybrid spoke
ember estuary
#

because i use it as a boolean

if config exists i run a function at serverstart, if not then not

hybrid spoke
#

i dont get the point but anyways, you need to get the File and then #delete it

ember estuary
#

not planning on saving anything in it atm, just need to save that one byte, so i thought i just use the config itself to do so

#

how do i get the file

hybrid spoke
#
File file = new File(path, name);
ember estuary
#

doesnt that create a new file

hybrid spoke
#

if the file already exists it refers to it

#

better said it represents the file

ember estuary
#

ok, so only run that code if config exists

#

how do i check if config exists? getDefaultConfig == null ?

hybrid spoke
#

file.exists

ember estuary
#

ah so it doesnt create the file

hybrid spoke
#

"it represents the file"

ember estuary
#

i see

hybrid spoke
#

#createNewFile would create it

#

if it doesnt already exist

ember estuary
#

ok, ty, ill try it