#help-development

1 messages · Page 2142 of 1

quaint mantle
#

wait no

#

no not at all

#

wait

#

yes

mortal hare
#

where inner static classes seems to be a way to solve some problems

quaint mantle
#

no thats right

#

jesus

#

the syntax is just weird

echo basalt
#

imajin having a stroke

mortal hare
#

?paste

undone axleBOT
ivory sleet
#

I mean its nice for iterators etc

mortal hare
#

I use inner static classes

#

for emulating enums

echo basalt
#

why do I hate this code so much

mortal hare
#

it just looks weird

#

thats all

#

but sometimes inner classes are a good way to encapsulate some parts of the code

#

which you wouldnt want to expose

quaint mantle
#
    public static Nameable CHEST_9X1 = Nameable.CHEST_9X1;
    public static Nameable CHEST_9X2 = Nameable.CHEST_9X2;
    public static Nameable CHEST_9X3 = Nameable.CHEST_9X3;
    public static Nameable CHEST_9X4 = Nameable.CHEST_9X4;
    public static Nameable CHEST_9X5 = Nameable.CHEST_9X5;
    public static Nameable CHEST_9X6 = Nameable.CHEST_9X6;

someone should make a lombok generator for stuff like this

#

@Wrapper

mortal hare
#

I don't use lombok

#

i prefer to see what my code does

echo basalt
#

we can tell

chrome beacon
#

Why no final

ivory sleet
#

^

echo basalt
#

I mean you can just write with lombok and call delombok whenever you start to lose touch with reality

mortal hare
#

i dont know

quaint mantle
mortal hare
#

thank you

cyan compass
#

Why does Player.Spigot.sendMessage say that the symbol of sendMessage isn't found?

quaint mantle
#

probably because it cant be found

cyan compass
#

well yes but shouldn't it be found?

quaint mantle
#

are you providing a basecomponent?

echo basalt
#

Player#spigot().sendMessage

quaint mantle
#

or a vararg basecomponent

echo basalt
#

you might be calling the static class

quaint mantle
#

or a chatmessagetype and basecomponent

#

or a chestmessagetype and a vararg basecomponent

cyan compass
mortal hare
#

sendMessage() is a method not a field, if you wrote it like that, ofc it wouldnt work. Just saying

echo basalt
quaint mantle
#

= instance call

echo basalt
#
Player player = ...;
player.spigot().sendMessage
cyan compass
#

yeah

#

Player play = event.getPlayer();

Player.Spigot.sendMessage

quaint mantle
#

thats not how it works dude

cyan compass
#

yes i know i need to provide fields to send message but send message doesn't exist

quaint mantle
#

no

#

you need an instance to call #spigot

cyan compass
#

ah

quaint mantle
#

notice the hashtag meaning an instance call

mortal hare
#

spigot() method is not necessary here, public inner class exposed to that (nvm)

tepid ore
#

I know that, but are there any other benefits? I always make them static, but why can you make them non static

#

I have like one occasion where I "need" non static

cyan compass
#

I'm just trying to figure out how to do an action bar :P

radiant cedar
#

will this write on the yml

#

even when uuid doesnt exist

#

on the file

quaint mantle
#

yes

tepid ore
radiant cedar
#

seems not to not work for me, my yml is still empty

quaint mantle
#

you need to save it

#

JavaPlugin#saveConfig()

radiant cedar
#

this is my yml rn

#

oh

cyan compass
mortal hare
ivory sleet
#

yes

#

Ive used it for goals, movecontrol, iterators, snapshotting and facading

tepid ore
radiant cedar
quaint mantle
#

dont

#

you'd have to hardcode the path

radiant cedar
#

yeye

#

i mean i didnt type path here

#

just mean

quaint mantle
#

get your plugin instance and call saveConfig

radiant cedar
#

path

next stratus
#

Use a config manager ;)

mortal hare
#
public class Foo {
  private final id;
  public Foo(int id) {
    this.id = id;
  }

  class Bar {
    private final int barId;

    public Bar() {
      this.barId = Foo.this.id;
    }
  }
}
#

this should be legal

#

afaik

#

even if the field of outer class is private

#

you could still access it via inner class

tepid ore
ivory sleet
#

I mean thats not the point of it

tepid ore
#

Am i dum

ivory sleet
#

you're supposed to access the outer class field directly

mortal hare
ivory sleet
#

thats the benefit

tepid ore
mortal hare
radiant cedar
#

When I have a String str = ChatColor.BLUE + "something";

mortal hare
#

i'm not going to implement

radiant cedar
mortal hare
#

Windows 11 just for an explanation

radiant cedar
#

just by str

tepid ore
mortal hare
#

Day 158. I still have a fobia for Object @NotNull []

echo basalt
#

lmao

echo basalt
radiant cedar
#

when i dont now what that "something" is

ivory sleet
quaint mantle
#

ew

echo basalt
#

:)

ivory sleet
#

(:

mortal hare
#

i wonder if this is possible to do with C style notation

quaint mantle
mortal hare
#

which is supported in java still

#

but it emits warning

#

at least in intellij

echo basalt
#

fun

mortal hare
#

Object foo[]; <- this is still legal in java

echo basalt
#

name it set() just for fun

#

lmao

crisp steeple
#

even better

echo basalt
#

nah wrong

#

make it Test. @NotNull Test2 @NonNls test[])

mortal hare
#

I hope future java versions will steal the idea of operator overloading from C++

crisp steeple
ivory sleet
#

there's nothing as confusing as operator overloading ngl

#

but can also be nice

#

altho its not in javas style to add that type of shortcut for the given verbosity itd substitute

echo basalt
#
public static void dA(Test. @NotNull Test2<@Nullable Test.Test3>.NonNls[] @NotNull bC) {
  return;
}
#

hmm

#

Nms be like

#

bet your decompiler has a stroke upon seeing that

crisp steeple
radiant cedar
#

When I have a String str = ChatColor.BLUE + "something";
how can i remove ChatColor.BLUE
when i dont know "something"

crisp steeple
#

ChatColor.stripColor

hollow arch
#

Hey hey,
Is there a way to get the itemstack that's being popped out of the itemframe?
Seem as though the one you can get with EntityDamageEvent#getEntity#getItem is a different one?

mortal hare
#

Since itemframe items are entities

#

you can try using this

hollow arch
#

yeah probably

#

I don't think those fire since you are not breaking the item frame, just popping the item out

crisp steeple
#

didnt know native was usable outside java.lang 😲

#

probably

hollow arch
ivory sleet
#

native has always been available pretty much

crisp steeple
#

think its probably always been there tbh and i just didnt notice

#

yea

#

dont really see how it could be used for anything though without major java compiler hacks

ivory sleet
#

jni

crisp steeple
#

i am not smart enough to use that

mortal hare
#

listeners do get disabled if the plugin gets disabled automatically, right?

lost matrix
#

There is nothing smart about that. All you do is compile some dlls and call functions from java.
If you know some C(++) then this is not exactly black magic. But since JIT is a thing i dont really see
a benefit. Maybe for AI applications or CUDA stuff.

ivory sleet
#

iirc thats the implementation

mortal hare
#

what do you need to call explicitly when disabling from the API

#

except for the shutdown plugin things

ivory sleet
#

not much

ivory sleet
#

I mean

eternal night
#

if that is what you mean

ivory sleet
#

strong references to other plugins should be dropped

#

thats bout it

#

and yeah I mean external io connections and streams should be closed probably

#

ig also services such as ExecutorService instances might deserve to be properly terminated

compact crane
#

Why is the BlockBreakEvent e.getDrops not exactly the number of items when I break the block with Fortune3? Can I query it to see how much is really dropping?

crisp steeple
#

try event.getBlock().getDrops(event.getPlayer().getItemInHand());

compact crane
#

Ok, i try

lost matrix
tepid ore
crisp steeple
#

probably, or use blockdropitemevent like smile said

lost matrix
compact crane
#

Thanks

#

It works

tepid ore
#

I need that

tender shard
#

I still wonder

#

why the returned list of drops is only partly mutable

#

like, you can remove items, but you can't add any

#

it seems a bit weird to me

past brook
crisp steeple
#

?paste

undone axleBOT
worldly ingot
#

Whatever your chunk generator is is not doing a great job

past brook
worldly ingot
#

core.jar//com.cmdpro.servercore.PlantPopulator.populate(PlantPopulator.java:30) is what's in the trace

past brook
#

hm

lost matrix
#

core.jar//com.cmdpro.servercore.PlantPopulator.populate fks up your chunk loading

past brook
#

ill send you the code in there

worldly ingot
#

Actually seems to be a few different places in your populators. TreePopulator as well

crisp steeple
#

it seems like it just places so many trees on the main thread it times out

worldly ingot
#

And plants, yeah, that's most likely the case

lost matrix
#

Im suspecting that the generator calls for the chunk so generation is triggered in a recursive loop.

#

Or it just takes way too long

worldly ingot
#

Already right off the bat, for (int i = 0; i < random.nextInt(50, 256); i++) {

#

You're going to want to generate that number once

#

Remember that that condition is checked and evaluated every iteration

past brook
#

ohhhh

#

maybe thats the issue

worldly ingot
#

It would run 256 times at most

lost matrix
#

You should not base your generation on a single chunk. Rather use some noise algo like OpenSimple to create
a double[][]. Then generate a tree if a field has a certain value (>0.9 for example)
After that you should play around with the frequency and amplitude to get thin high amps for single trees.

worldly ingot
#

I'd +1 that, yeah. I was about to suggest something a bit more mathematical

#

For convenience by the way, there is World#getHighestBlockAt() and #getHighestBlockYAt(). No need to loop it yourself. You can make use of height maps to ignore water or leaves

#

Spigot does have noise generators by the way

#

Perlin and Simplex

tender shard
#

wow wtf

#

octaves?

#

I wonder what that means in this context lol

dusk flicker
#

noise

tender shard
#

I only know that term "octave" from music etc

kindred valley
#

how do i get all the args that the player entered for the command

crisp steeple
#

just use the args array?

kindred valley
dusk flicker
#

args.length?

kindred valley
#

i know that shit wtf

tender shard
#

I think they want to do String.join(" ",args).length

kindred valley
#

i cant explain myself

crisp steeple
#

(command.getName() + " " + String.join(" ", args)).length

kindred valley
#

what is join

#

wait

dusk flicker
#

it joins the provided list together

tender shard
#

well String.join does this:
args[0] = "my";
args[1] = "name";
String result = String.join(" ", args); // It's now "my name";

dusk flicker
#

with the string provided seperating

lost matrix
kindred valley
crisp steeple
#

if you're just trying to add a character limit on commands CommandPreprocessEvent

tender shard
kind hatch
#

String#length()?

dusk flicker
#

do you mean in a command or like a player talking in chat

crisp steeple
tender shard
crisp steeple
#

its that simple

dusk flicker
#

then you have had your answer 5x over

crisp steeple
#

i didnt know String.join existed for a while and for the longest time i was manually stringing arguments together ;-;

tender shard
#

it exists since Java 1.0 IIRC lol

lost matrix
#

new approach:

int size = String.join(" ", args).length
crisp steeple
#

idk why i never thought to check for a method like that

lost matrix
#

Never seen before

dusk flicker
crisp steeple
#

life got so much easier after i found it

kindred valley
#

arg length?

dusk flicker
#

the length of all args combined by a space

tender shard
dusk flicker
#

I think this calls for a

#

?learnjava

undone axleBOT
kindred valley
#

?

torn shuttle
#

meanwhile if you're learning unity you have to unlearn programming and get ready to commit some programming war crimes

dusk flicker
#

war crimes are fun

echo basalt
#

I wonder if we can make a sound-based world generator

tender shard
#

for example, this prints "15":

    public static void main(String[] args) {
        String[] message = new String[] {"my","name","is","jeff"};
        System.out.println(String.join(" ",message).length());
    }
lost matrix
# kindred valley ?

Input: /msg some arguments in msg
args: ["some", "arguments", "in", "msg"]
After join: "some arguments in msg"

It has been explained several times now

dusk flicker
#

as long as you are the one doing them

crisp steeple
#

String[] test = new String[]{"this", "is", "a", "test"};
String.join(" ", test) ----> "this is a test"

tender shard
torn shuttle
crisp steeple
#

we all made an example at the same time lol

echo basalt
#

where we scream at a mic and the louder we scream, the taller the mountains become

#

and background noise makes trees or something

#

and if we say wowowowowowo we can end up with some very funky terrain 🤔

torn shuttle
kindred valley
#

okay you dont need to be moody

tender shard
lost matrix
echo basalt
#

yeah that's where I was going off of

kindred valley
echo basalt
#

and then the same noise will always make the same world

dusk flicker
#

"noone"

echo basalt
#

and then we make NFTs out of screams

dusk flicker
#

fuck NFTs

crisp steeple
#

i am mooding right now

torn shuttle
#

the only terrain generator that might get a dmca takedown notice

dusk flicker
#

wait what

echo basalt
#

or maybe grab an image and convert pixel data to noise somehow

dusk flicker
#

oh lol

#

was missing some context on that one

echo basalt
#

I wonder what an FBI-warning generated world would be

torn shuttle
echo basalt
#

yeah except instead of using just funky numbers we can use memes

#

what if we grab every frame on the shrek movie and convert it to noise, feed that all into an algorithm and end up with a great world

lost matrix
echo basalt
#

yes

tender shard
#

nooo

#

not despacito

echo basalt
#

the audio makes the ores, the video makes the terrain itself

#

if it's hella loud, there will be more ores

torn shuttle
#

this idea is as worthless as it would be likely to get 3 million views on youtube if you made a video about making it

tender shard
echo basalt
#

Le crochet reminds me of Fish au chocolat

tender shard
#

"Le Crochet" is french for "the hook" iirc

echo basalt
#

and maybe start a trend off of meme worlds

#

and get famos

#

either that or I'm extremely sleep deprived

kindred valley
#

I tried to remove arg[0] with for loop but its colliding

#

how can i remove arg[0] without any exception

tender shard
#

You have to create a new array to "remove" the first element

tepid ore
tender shard
#

I use this to do it:

    public static <T> T[] shiftArray(T[] original) {
        if(original.length == 0) return original;
        T[] shifted = (T[]) Array.newInstance(original.getClass().getComponentType(),original.length-1);
        if(shifted.length == 0) return shifted;
        System.arraycopy(original, 1, shifted, 0, shifted.length);
        return shifted;
    }
#

obviously you can replace "T" with "String" if you only need it for strings

echo basalt
#

you replied to the wrong message and I got extremely confused

tender shard
#

oh

#

sorry

#

I tend to reply to the wrong message very often

#

lol

echo basalt
#

That does seem like a fairly simple method hmm

#

I wonder if it's possible to simplify it further

lost matrix
quaint mantle
#

only way to block opening crafting tables is with interact? bc inventoryopen and checking the type didn't work

tender shard
tender shard
quaint mantle
#

i did

#

and i checked InventoryType

tender shard
#

where's the problem?

quaint mantle
#

it just didn't work

#

and it allowed it to open

tender shard
#

what type did you compare to?

quaint mantle
#

CRAFTING

tender shard
#

no

#

WORKBENCH

#

CRAFTING is the player's own inventory

quaint mantle
#

lemme check

lost matrix
quaint mantle
#

ah

quaint mantle
#

yea i didn't do workbench

tender shard
#

creating a deque just to copy an array?

quaint mantle
#

thanks

tender shard
#

np

lost matrix
radiant cedar
#

can u only have the given ChatColors for colors in scoreboard and chat

#

or can i use any custom color code

tender shard
#

chat supports hex colors

radiant cedar
#

cant have brown?

tender shard
#

idk, check the ChatColor class

dusk flicker
#

i thought scoreboard supported rgb

tender shard
#

hm maybe I'm wrong

dusk flicker
#

but not fun

lost matrix
silent vigil
#
> Could not resolve all files for configuration ':Bungee:compileClasspath'.
   > Could not find net.md-5:brigadier:1.0.16-SNAPSHOT.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/net/md-5/brigadier/1.0.16-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/net/md-5/brigadier/1.0.16-SNAPSHOT/brigadier-1.0.16-SNAPSHOT.pom
       - file:/C:/Users/Punchline/.m2/repository/net/md-5/brigadier/1.0.16-SNAPSHOT/maven-metadata.xml
       - file:/C:/Users/Punchline/.m2/repository/net/md-5/brigadier/1.0.16-SNAPSHOT/brigadier-1.0.16-SNAPSHOT.pom
     Required by:
         project :Bungee > net.md-5:bungeecord-api:1.16-R0.4 > net.md-5:bungeecord-protocol:1.16-R0.4

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

``` error on attempting to compile with gradle, anyone know where to get the brigadier thing?
tender shard
echo basalt
#

Jmh tunes garbage collection and all

#

With accurate numbers, failure rates

#

Well

#

You're calling that code on another thread

#

Bukkit doesn't like it

#

Bukkit.isPrimaryThread

#

Returns true if you're on the main thread

lost matrix
# tender shard why not? except for the obvious thing that I didn't run it 200 thousand times
Benchmark                              (amountOfArguments)  Mode  Cnt   Score   Error  Units
ArrayVsDequeArgsPop.argsFromArrayCopy                    2  avgt    4  25,643 ± 0,265  ns/op
ArrayVsDequeArgsPop.argsFromArrayCopy                    3  avgt    4  49,742 ± 0,351  ns/op
ArrayVsDequeArgsPop.argsFromArrayCopy                    4  avgt    4  71,057 ± 0,715  ns/op
ArrayVsDequeArgsPop.argsFromArrayCopy                    5  avgt    4  96,647 ± 0,694  ns/op

ArrayVsDequeArgsPop.argsFromDequePoll                    2  avgt    4  15,959 ± 0,099  ns/op
ArrayVsDequeArgsPop.argsFromDequePoll                    3  avgt    4  32,533 ± 0,325  ns/op
ArrayVsDequeArgsPop.argsFromDequePoll                    4  avgt    4  38,818 ± 0,238  ns/op
ArrayVsDequeArgsPop.argsFromDequePoll                    5  avgt    4  40,677 ± 1,473  ns/op

https://paste.md-5.net/urugotayox.java

There is only a single time when copying the whole array is faster: When there are exactly 2 elements in the array.

lost matrix
echo basalt
#

Use the scheduler to run the task on the main thread

tender shard
lost matrix
tender shard
#

you cannot compare this

#

you are never turning the deque into an array again, do you?

tender shard
#

are you actually converting the deque into an array again?

lost matrix
#

Why would i? I thought this was used to simply pop args from an array

tender shard
#

someone who says "how can I remove the first element of my T[]" wants a T[] as result and not a Deque<T>

#

otherwise they wouldn't have asked this question I guess

lost matrix
tender shard
#

I mean I totally agree with you that a Deque<T> is probably more useful and also faster. But the question was "how to remove the first element of an array" and not "how to remove the first element of a deque"

#

and I think in 99.9999% of cases, the performance of both operations is really neglible

#

if someone is removing the first element of an array 10 thousand times per tick, they're doing something wrong anyway lol

lost matrix
#

true

#

My only point is: Dont reinvent the wheel
But i have no idea what this limpeex guy was talking about anyways...

tender shard
#

lol yeah I think they wanted to do sth like this:

#

have a /msg command, and a message can only have up to 500 letters or something

#

and obviously args[0] is probably the receiving player's name

#

so they wanted to turn args into args without the first element, then check if the "length" of the joined string is less than 500 or whatever

#

that's the only explanation that makes sense to me

lethal coral
#

If I'm integrating JDA into my plugin, should I be running most JDA-related things async?

compact haven
#

System#arraycopy() will automatically create a new array if the src and dest arrays are the same, so you're just doing legwork that it can do itself

sterile token
#

Hi want to know if possible to fix this issue - a friend has a custom enchant plugin which allow him to use unbreaking lvl 10 for example, but then you compare the armor with another and its the same as enchanting it with unbreaking lvl 3

quaint mantle
#

hello everyone

#

i am once again asking for assistance on how to make a certain entity glow for one player

#

ii am not very good with protocolib and my knowledge with packets is very basic

grand perch
#
shop:
  blocks:
    grass:
      itemName: §7Grass Block
      price:
        buy: 10
        sell: 5
    dirt:
      itemName: §7Dirt Block
      price:
        buy: 5
        sell: 2
  food:
    steak:
      itemName: §6Cooked Beef
      price:
        buy: 1
        sell: 1

my goal:
for each item in blocks make an item and put it in the gui

#

how?

sterile token
#

First you ill need to loop the "food" section

grand perch
#

ok

#

how

#

food is an object not an array

sterile token
#

Oh ait

#

I was wrong

#

You have 2 sections there

grand perch
#

yah food, blocks and other are hard coded

#

but the children are configureable

sterile token
#

So you will have to loop each section with Config#getConfiguractionSection()#getKeys(false)

#

And then build the item and add to the menu

grand perch
sterile token
#

Explain a bit more

grand perch
#

hwat

sterile token
#

I didnt understand your question

grand perch
#

i want to loop over all items in blocks

#

and build said item

sterile token
#

Yeah i explained you

#

Have you worked with spigot api before?

grand perch
#

bcs i always just hardcode the configs

sterile token
#

Allright so i recommend forward learning that

#

Because if not its diff to explain

#

And my goal is you to understand how it works, not to just spoof the code

quaint mantle
#

sping spoof

sterile token
wind tulip
#

Hey, can someone help me debug this error? I can't figure it out.

Error: https://pastebin.com/4s62fUqg
Library method: https://pastebin.com/L7xp7cTY
Call From Main Class: Bukkit.getOnlinePlayers().forEach(p -> DFSpigotLib.PlaySounds(p, new String[] {"Chime","Chime","Bit"}, new Location(p.getWorld(), 5.929617510431854, 50, 4.765213468406728, -73.46591f, 21.44098f), new float[][]{{2f, 0.749154f},{2f, 0.840896f},{2f, 2f}}, (long) 50));

summer scroll
#

So I have a plugin that can launch a fireball with custom damage, and it will damage every entity in 3 radius of the explosion, for some reason it will broke a totem, so the totem got used but the player still dies.

This is how damage the entity

for (Entity nearby : fireball.getNearbyEntities(3, 3, 3).stream().filter(entity -> entity instanceof LivingEntity).toList()) {
  ((LivingEntity) nearby).damage(FireShardConfig.INITIAL_DAMAGE * power);
}
grand perch
#

whats a deep

round agate
# grand perch yes but not with the FileConfiguration stuff

Your config file is a ""FileConfiguration""
You can load the config file by using YamlConfiguration.load(yourConfigFile)

Then you can get the ConfigurationSection out of the FileConfiguration

For example, in your config file:
The shop is a section of the config file
The blocks is a section of the shop section.

So on...

You can use loop and get the keys then get then use ConfigurationSection or FileConfiguration to get the value out of the key.
Then proceed to create your item by using the value you just recieve

sterile token
#

😆

round agate
#

Yeah. I didn't scroll up

sterile token
grand perch
#

yes the variable name

#

.getkeys takes a deep
whats that

round agate
grand perch
#

oh its a boolean

#

i assume i want it to be true

sterile token
#

So in this case:

  1. "test" is the path and the "value" its a string
  2. "users" is the path of a section, it contains 2 childrens called "uuid-1" and "uuid-2"
test: "value"

users:
  uuid-1:
    name: ""
    coins: 10
  uuid-2:
    name: ""
    coins: 10 
grand perch
#

i understnad that part

#

the part i dont is the looping

sterile token
#

I do a simple example:

FileConfiguration config = config getter;

ConfiguractionSection blocks = config.getConfigurationSection("shop.blocks");
ConfiguractionSection food = config.getConfigurationSection("shop.food");

for (String key : blocks.getKeys(false)) {
  System.out.println("Block name: " + key + ", display: " + section.getString("shop.blocks." + key));
}
#

There you have a simple example

#

In the case you are working with sections, the getKeys() method will returned each children name

#

@grand perch if you need more help just ask!

grand perch
#

okay

sterile token
#

Do you understand that code i sent know?

grand perch
#

sort of

round agate
#

spoonfeed!!! i will report you to spigot supreme court!!!

grand perch
sterile token
#

Hahah i didnt want that but its 3am so im sleepy to explain in another way and even more if you are not english native speaker

#

🤙

#

I recommend watching about good practices when developing

grand perch
#

Cannot resolve symbol 'ConfiguractionSection'

sterile token
#

Hmn?

#

Have you imported the spigot api?

round agate
#

Configuration not Configuraction

grand perch
#

Cannot resolve symbol 'section'

quaint mantle
#

?learnjava

undone axleBOT
sterile token
#

WHy you randomly appear for help and just throw "shity to people"

#

Like you dont help much in that way

quaint mantle
#

im telling him to learn java

sterile token
#

Oh

grand perch
#

i do

#

i assume i do

sterile token
#

Yeah i suppoused that

quaint mantle
grand perch
#

yeah i fixed it

#

before you even said it

quaint mantle
#

actually he didnt declare it

#
ConfiguractionSection blocks = config.getConfigurationSection("shop.blocks");
ConfiguractionSection food = config.getConfigurationSection("shop.food");

for (String key : blocks.getKeys(false)) {
  System.out.println("Block name: " + key + ", display: " + section.getString("shop.blocks." + key));
}
#

can i recommend something

sterile token
#

Yes please

#

I always learn something knew

#

So go ahead my guy

quaint mantle
#
shop:
  0:
    material: COOKED_BEEF
    name: "&4Steak"
    price:
      buy: 10
      sell: 2.5
#

i think the config would look best like this

quaint mantle
#

its the inventory slot of the item

sterile token
#

Imajin i do something worst hahahaha

grand perch
#

ok

sterile token
#

I just keep all the config item on Object!!

grand perch
#
shop:
  blocks:
    0:
      itemName: §7Grass Block
      price:
        buy: 10
        sell: 5
    1:
      itemName: §7Dirt Block
      price:
        buy: 5
        sell: 2
  food:
    0:
      itemName: §6Cooked Beef
      price:
        buy: 1
        sell: 1
sterile token
#

But only when doing items that need to do custom things

sterile token
#

Why food its diff?

#

Like why you dont just use one section?

grand perch
#

bcs food is a diffrent category on the shop

sterile token
#

Oh ok

#

That why i use a menu api

#

So i can use this in config:


Shop:
  category-1:
    0:
      name: "bla la"
      price: 10
    1:
      name: "bla la"
      price: 10
  category-2:
    0:
      name: "bla la"
      price: 10
    1:
      name: "bla la"
      price: 10
quaint mantle
#

i copy every guide on spigot for entity metadata packets

#

and not one of them work

#

is anyone able to help me fix my protoclib code to make an entity glow

sterile token
#

See you soon people i will go to sleep

sterile token
grand perch
#

why name it category-x when i can just name it the category name

quaint mantle
#

no harm in asking again so someone might see it

sterile token
sterile token
quaint mantle
#

ok man...

sterile token
#

You should respect the rules

#

I have been banned many times for double posting code every time...

quaint mantle
#

ive been here for 2 years and ive never had someone have a go at me for doing what i do

#

people are genuinely nice here

grand perch
#

i tested it

#

it doesnt send anything

#
                        ConfigurationSection blocks = config.getConfigurationSection("shop.blocks");
                        //ConfigurationSection food = config.getConfigurationSection("shop.food");

                        for (String key : blocks.getKeys(false)) {
                            System.out.println("Block name: " + key + ", display: " + config.getString("shop.blocks." + key));
                            player.sendMessage("Block name: " + key + ", display: " + config.getString("shop.blocks." + key));
                        }

this is the updated code i tested

quaint mantle
#

i know i've asked a few times but im getting confused with how packets work

i thought it should just be possible to send an entity metadata update to one player and make the entity glow/not glow, however this never works

do i have to do something like, use the spigot API to go entity.setGlowing(true) and then listen to the entity metadata update packet and interecept it so only some players can see the change or is the first approach possible

quaint mantle
#

ok so update for anyone curious i've been playing around with it

    public void addGlow(Player player, Entity target) {
        PacketContainer packet = getInstance().getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
        packet.getIntegers().write(0, target.getEntityId()); //Set packet's entity id
        getInstance().getServer().broadcastMessage(target.getEntityId() + " id");
        WrappedDataWatcher watcher = new WrappedDataWatcher(); //Create data watcher, the Entity Metadata packet requires this
        WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class); //Found this through google, needed for some stupid reason
        watcher.setEntity(target); //Set the new data watcher's target
        byte flag = 0;
        flag |= 0x01;
        flag |= 0x02;
        flag |=  0x08;
        getInstance().getServer().broadcastMessage(flag + " flag");
        watcher.setObject(0, serializer, flag); //Set status to glowing, found on protocol page
        packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); //Make the packet's datawatcher the one we created
        try {
            getInstance().getProtocolManager().sendServerPacket(player, packet);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

this works for under a millisecond, i honestly think the only reason i can see the changes is because i have a 240hz monitor

#

i can see the player crouching+sprinting etc but then it goes back instantly to normal

#

what am i missing

chilly fox
#

anyone got a nice announcement plugin?

mellow edge
#

has bungee cord the same code as spigot?

harsh totem
#
        ItemStack[] inv = player.getInventory().getContents();
        int count = 0;
        for (int i = 0; i < inv.length-4; i++){
            if (inv[i] != null){
                if (inv[i].isSimilar(item)){
                    count += worth * inv[i].getAmount();
                    player.getInventory().setItem(i, null);
                }
            }
        }
        GiveCoins(player, count);
    }```
When I call this function like this `SellItem(player, item, 1);` I get 1299 coins and IDK why.
If I call it and I have something valuable in my inventory is gets it and gives me the right amount of money + 1299 for some reason
#

I don't understand where's the 1299 from

#

I tried calling it with any worth and item and it always returns the right amount + 1299

#

The count in the function is fine

#

the count is what it's supposed to be

#

but I still get 1299 more coins than I should

#

The function GiveCoins() is also fine and works correctly

graceful fiber
#

How could I make my plugin be useable in more than one version?

wet breach
tardy delta
#

if i'm getting a collection from a database, is a set better than a list?

wet breach
#

depends on what you need to do with the collection

graceful fiber
#

like is it possible to do thjat?

wet breach
#

yes it is possible

graceful fiber
#

I mean it's possible but is it possible for a plugin thats already made

wet breach
#

the easiest way is to make use of API methods only and then use multiple classes for where API is slightly different and identifying the version plugin is being ran on for this which you can make use of Enums for this

graceful fiber
#

or would I have to er make the project or re write the pom.xml

wet breach
#

if you need to use NMS it gets a bit more complex

#

but still doable

graceful fiber
#

yeah I'm not that good

round agate
wet breach
#

you don't need a multi-module for API only

graceful fiber
#

hmm, still I haven't done anything with NMS yet.

wet breach
#

API is only different between certain sets of versions

graceful fiber
#

I actually wanna make my plugin useable from 1.16 to 1.18

wet breach
#

and even then it really depends which methods are being made use of as not everything changes in the API

tardy delta
round agate
#

i think he's talking about NMS

wet breach
#

from 1.16 to 1.18 not much really needs to be done except compiling against 1.16

graceful fiber
wet breach
#

yes compiling for 1.16

graceful fiber
#

yeah I don't know how to do that

wet breach
#

means the plugin can be used in 1.17 and 1.18

#

you don't need to compile specifically for higher versions unless you want to make use of methods that exist in those versions specifically

graceful fiber
wet breach
#

which I am not aware of any major changes between 1.16 to 1.18

#

if you compile for 1.16 it should work in 1.16+

wet breach
#

especially in regards to collections sometimes

graceful fiber
#

I see.

#

If I compile for 1.18, it won't work for 1.16

wet breach
#

correct

graceful fiber
#

but how can I shift it from 1.18 to 1.16

wet breach
#

you use 1.16 as the dependency to compile against, use the API methods that exist in 1.16 which should exist in later versions

#

which you will need to test

kindred valley
#

how can i remove specified element from an array

wet breach
#

if the methods are different or have been changed in a later version, this is where you have to make use of multi-class specific code

#

or as stated earlier multi-module

wet breach
kindred valley
quaint mantle
#

is there an updated and working glowapi

#

for 1.18

kindred valley
wet breach
#

you mean the index of the rest of the elements?

kindred valley
#

?paste

undone axleBOT
wet breach
#

your method is a void method

#

since you don't have a global array for the string

#

the void method essentially provides nothing once it is done

#

it is lost into the void

#

instead of a void method, change that to String[]

#

and then return an array 🙂

tardy delta
#

hmm im looking for a way to work around this:
i have a Storage interface with one abstract method: Set<Home> loadHomes() and i want to have two implementations of that interface: a YamlStorage and a H2Storage but i want to work with futures in the h2 one, but i cant just change the return type from Set<Home> to Future<Set<Home>>, maybe i can work with callbacks idk whats the best to handle this

wet breach
#

sounds like you need an interface

#

so you can override

tardy delta
#

an interface for what?

wet breach
#

instead of using Abstract

#

you could change it to an interface and then have the following classes implement it, and override it if necessary

tardy delta
#

ye but i want to 'override' the return type in the H2Storage to be a Future<Set<Home>> instead of a Set<Home>

#

do you understand?

#

x)

tardy delta
#

there is an PlayerInventory#containsAtLeast method

wet breach
#

and need to move the concreteness to the lower levels instead

tardy delta
#

ye that happened to me many times before, dunno really how to fix it

wet breach
kindred valley
#

same happening

wet breach
#

o.O

#

did you use /reload?

#

if so probably best to just restart the server lol

#

you should have gotten something different back

kindred valley
harsh totem
wet breach
#

restart the server

quaint mantle
#

how do i get a datawatcher in 1.18

kindred valley
wet breach
#

I don't mean reloading anything. Just stop and start the server or otherwise known as restarting

tardy delta
harsh totem
#

There shouldn't be any problem

tardy delta
#

whats not working?

#

also method names should start with a lowercase character

#

SellItem -> sellItem

harsh totem
#

Get*

quiet ice
#

that is an odd number

tardy delta
#

maybe you only want to check the material?

harsh totem
#

Wdym

tardy delta
#

instead of checking if the itemstack is similar

#

@wet breach im pretty sure there is a better way

wet breach
#

There is, you need to do the reverse for your API

#

let your storage classes set the methods, make a class that combines all the storages into easy methods

tardy delta
#

so no storage interface

wet breach
#

you can, just its doing the opposite

#

instead of going from 1 top class, you are starting with a multiple and then condensing down

harsh totem
tardy delta
#

getType

wet breach
#

this is obviously where it is going wrong

#

I have a feeling it has to do with that multiplication on the right

humble tulip
#

Count = count + worth * item amt

wet breach
humble tulip
#

Where?

harsh totem
humble tulip
#

I just opened this chat

wet breach
humble tulip
#

👀

harsh totem
wet breach
#

try changing it to this then

harsh totem
#

???

humble tulip
#

Oh it's a sellitems method

wet breach
#

count = ((count + worth) * inv[i].getAmount());

quiet ice
#

that likely does not do what the user wants

tardy delta
#

isnt worth the price?

humble tulip
#

No because you're multipling the previous cost by the amount

harsh totem
humble tulip
#

Isn't that growing exponentially now?

quiet ice
harsh totem
#

yes

#

count always gets to what it should be

quiet ice
#

And even just before invoking the giveCoints method?

harsh totem
#

This is giveCoins(). I already checked it and it should be fine

        int[] amount = new int[9];
        amount[8] = coins / 10000;
        coins %= 10000;
        amount[7] = coins / 5000;
        coins %= 5000;
        amount[6] = coins / 2000;
        coins %= 2000;
        amount[5] = coins / 1000;
        coins %= 1000;
        amount[4] = coins / 500;
        coins %= 500;
        amount[3] = coins / 200;
        coins %= 200;
        amount[2] = coins / 100;
        coins %= 100;
        amount[1] = coins / 10;
        coins %= 10;
        amount[0] = coins;
        ItemStack[] items = {Coins.one.clone(), Coins.ten.clone(), Coins.hundred.clone(), Coins.twoHundred.clone(), Coins.fiveHundred.clone(), Coins.thousand.clone(), Coins.twoThousand.clone(), Coins.fiveThousand.clone(), Coins.tenThousand.clone()};
        for (int i = 0; i < items.length; i++){
            items[i].setAmount(amount[i]);
            player.getInventory().addItem(items[i]);
        }
    }```
quiet ice
#

In that case, it's the giveCoins method that is bork, not your sellItems one

#

Oh yeah, that has huge potential to be borked

harsh totem
quiet ice
#

Even with the same value?

wet breach
#

ah yes modulus

harsh totem
wet breach
#

o.O

quiet ice
#

And for your sellItems method it just gives 1299 coins more?

harsh totem
#

yes

quiet ice
#

Even if you give it 345 coins?

harsh totem
#

yes

quiet ice
#

sounds inplausible

harsh totem
#

I checked it. if count == 0 in the end of the function I still get 1299

wet breach
#

I can see how they are getting that

#

not sure why you are doing your math like that though

harsh totem
#

and that's how I called this function

                    SellItem(player, item, 1);```
wet breach
#

so why are you using an array to do counting?

harsh totem
#

to make the code shorter

wet breach
#

that doesn't seem shorter to me

#

your math isn't correct for doing counting via array

harsh totem
wet breach
#

if you wanted to do math that way, you would need to do it similarly when doing math for binary

harsh totem
#

?

quiet ice
#
private void giveAmount(Player p, ItemStack is, int amount) {
    is = is.clone();
    is.setAmount(amount);
    player.getInventory().addItem(is);
}
public void GiveCoins(Player player, int coins){
        giveAmount(player, Coins.tenThousand, coins / 10000);
        coins %= 10000;
        giveAmount(player, Coins.fiveThousand, coins / 5000);
        coins %= 5000;
        giveAmount(player, Coins.twoThousand, coins / 2000);
        coins %= 2000;
        giveAmount(player, Coins.thousand, coins / 1000);
        coins %= 1000;
        giveAmount(player, Coins.fiveHundred, coins / 500);
        coins %= 500;
        giveAmount(player, Coins.twoHundred, coins / 200);
        coins %= 200;
        giveAmount(player, Coins.hundred, coins / 100);
        coins %= 100;
        giveAmount(player, Coins.ten, coins / 10);
        coins %= 10;
        giveAmount(player, Coins.one, coins);
    }

Without an array it is one line shorter

humble tulip
#

Why do u have to clone the item each time?

#

If you're setting the amount each time

#

Oh i guess other usages

harsh totem
quiet ice
#

I guess it isn't really needed there actually

quiet ice
#

As long that is the only usage of it that is

humble tulip
#

You mean instances of those items?

quiet ice
#

As CB will clone the itemstack again once you call #addItem

harsh totem
# humble tulip ??

lets assum i set the amount to 64 to give it, if i try to use another command that uses the item that i used before, the mount would stay 64 until i reload the plugin

quiet ice
#

As long as the amount is irrelevant for other logic, you can ignore that fact

humble tulip
#

Yeah^

quiet ice
#

But really this is just a minor nitpick about performancee

#

Though depending on the plugin it can be a justified nitpick, cloning is expensive

harsh totem
#

well I wanted to get help because my command isn't working. my performance is mostly fine

humble tulip
#

Well if performance is fine you can keep it as is until you need to optimize i guess

#

At the end of givecoins

#

What's the value of coins?

harsh totem
wet breach
#

if performance is your concern

#

you could easily do this with bitshifting

#

and know all the remainders in one go of a loop

wet breach
#

but seems you are just making this more complex then it really needs to be

#

just because it is shorter in terms of lines, doesn't make it better or more optimal

harsh totem
#

IK. I'm not trying to make it efficient

humble tulip
#

I'm not exactly sure why it doesn't work

#

It seems likes it's supposed to

harsh totem
#

I just reloaded to check and it doesn't

#

idk why

quiet ice
#

It is probably some random method that appears unrelated but actually bricks the method in an unexpected way

#

But really you'd need the full source to estimate what is going on. Just did a test myself on my own impl and it seems to work right

harsh totem
#

Maybe I can make a function to remove coins and always remove 1299 from the player after he sells anything

quaint mantle
#

in 1.18 spigot you cant use ENTITY_METADATA properly, the changes last for a millisecond before going away

radiant cedar
#

how can I make it so that nobody can break blocks in the server but they can only at given spots of like 30x30s

harsh totem
#

?paste

undone axleBOT
harsh totem
quaint mantle
#

im convinced its broken

#

ive been at it for a day and tried every tutorial

quiet ice
#

You have no breaks in your onClick method, are you sure that that is wanted?

glass mauve
#

I have also problems with packets and ENTITY_METADATA

quaint mantle
#

i swear its broken?"

#

idk who to ask or what to do

#

feel like ive just wasted a day trying to do the impossible

glass mauve
#

so setting my itemframe invisible works, but settings the item inside is weird

harsh totem
#

@quiet ice the break was the problem

#

thank you

quaint mantle
quiet ice
#

np

harsh totem
#

sorry for wasting your time

#

i should have checked that

glass mauve
quaint mantle
#

idk its just fucked haha

#

this has to be the least documented version of MC

#
        new BukkitRunnable(){
            public void run(){
                Player p1 = getServer().getPlayer("account1");
                Player p2 = getServer().getPlayer("account2");
                getGlowManager().setGlowing(p1, p2, true);
            }
        }.runTaskTimer(this, 0, 1);
#

this makes it work

#

so idk wtf is going on

humble tulip
#

@harsh totem I'd recommend you make classes for coins and sellableitems

quiet ice
#

Reee BukkitRunnable

quaint mantle
#

this is what im saying

#

works for 1 millisecond then breaks

quiet ice
#

Use lambdas

quaint mantle
#

no i dont want to use it haha

#

im saying why cant the packet persist

#

theres something wrong with it

#

like i noticed today when i was testing if i sent the packet to set a palyer on fire/running itd work for a millisecond

#

and then disappear

#

what in 1.18 is so different that it gets rid of the changes instantly

quiet ice
quaint mantle
#

idk i can read through it all but tbth my knowledge on packets is so small and limited i wouldnt be able to find it if u put it right in my face

wet breach
#

as in you are not setting it to just 1 tick?

quaint mantle
#
public void setGlowing(Player player, Entity target, boolean glowing) {
        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
        packet.getIntegers().write(0, target.getEntityId()); //Set packet's entity id
        WrappedDataWatcher watcher = new WrappedDataWatcher(); //Create data watcher, the Entity Metadata packet requires this
        WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class); //Found this through google, needed for some stupid reason
        watcher.setEntity(target); //Set the new data watcher's target
        byte entityByte = 0x00;
        if (glowing) {
            entityByte = (byte) (entityByte | 0x40);
        } else {
            entityByte = (byte) (entityByte & ~0x40);
        }
        watcher.setObject(0, serializer, entityByte); //Set status to glowing, found on protocol page
        packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); //Make the packet's datawatcher the one we created
        try {
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
#

heres my code

quiet ice
wet breach
#

whatever it is you are trying to do. Things done via packets have to be constantly sent because generally the server is unaware of what you are doing and thus when the server sends an entity update to the client

#

it removes your changes

quiet ice
#

Where do you set the duration?

quaint mantle
#

this used to work fine in older versions

quiet ice
#

Likely because of how 0 (or whatever the default val was) was treated

quaint mantle
#

how do you mean

wet breach
#

just because it worked fine in older versions, doesn't mean older protocol versions are the same

quaint mantle
#

glowapi is broken as well so idk what my options are to fix this

#

yeah i mean thats true

quiet ice
#

Well, assume the default duration is 0, before it was treated as an infinite time period, now it is treated as less than a tick

quaint mantle
#

right

#

wait quick question are you saying it's like a potion effect?

wet breach
#

I just know when you are doing things with packets in regards to entities especially setting their metadatas. If you are not cancelling the entity updates in the server events, then the server sending the update will wipe your changes.

quiet ice
quaint mantle
#

i can track who should/shouldnt see glows

quiet ice
#

oh it's entity metdata

quaint mantle
#

yeah

#

u CANN use potions but that seems doodoo

#

like isnt the point of manipulating the datawatcher to stop the server from wiping changes?

quiet ice
#

I think exactly that is happening rn

#

but uh, I am not really knowledgeable in this field

quaint mantle
#

either

#

idk if anyone reading this has a solution i’m gonna give it a rest but i’d appreciate any input or push in the right direction

quaint mantle
glass mauve
#

do I need to listen for outgoing meta packets aswell? I create an invisible item frame (working) and want to set the item inside, but that spawns and despawns instantly

quaint mantle
glass mauve
#

the itemframe is an packet

lost matrix
#

Then the server wont send any packets for this item frame because it doesnt know that the item frame exists.

glass mauve
#

ok, but why is my itemframe with map with image not working ._.

lost matrix
glass mauve
#

I have this:
PacketManager.sendItemFrame(player, l.getX(), l.getY() + y, l.getZ() + z, true, map); and map is an itemstack, when I change map to
new ItemStack(Material.APPLE), then its working

wet breach
#

regardless of how you are creating the itemframe with the map in it via packets. The reason it disappears is you will have to stop and modify any block or chunk updates near your item frame otherwise it will vanish from the client

lost matrix
glass mauve
#

eh no ig, but still it works with an APPLE

tardy delta
#

im still confused when people say apple

#

i know what it means but ye

quaint mantle
quaint mantle
lost matrix
quaint mantle
#

it shouldnt be that drastic anyway

#

how do i go about grabbing an entity’s already existing datawatcher

lost matrix
#

?paste

undone axleBOT
quaint mantle
#

My Intellij goes to 100% cpu usage when decomiling Material.class

opal juniper
#

not suprised

#

its a huge class

lost matrix
lost matrix
quaint mantle
#

ive had to go afk for a while so ill trst when im back

#

ty for the help

quaint mantle
#

frick

#

ok finally

#

cool

#

im gonna import those sources really fast

#

:P

quaint mantle
grim oak
#

how would i do something like event.getClickedBlock() == Anvil like how would i do the anvil bit

#

because Material.Anvil isnt working cuz it gets a block and not a material

lost matrix
grim oak
#

ah ty

lost matrix
# quaint mantle ty

Ok i got it to work. This is an example that lets me set an entity glowing for 1 second after hitting it:

  @EventHandler
  public void onInteract(EntityDamageByEntityEvent event) {
    if (event.getDamager() instanceof Player player) {
      Entity entity = event.getEntity();
      glowManager.setGlowing(player, entity);
      Bukkit.getScheduler().runTaskLater(this, () -> glowManager.stopGlowing(player, entity), 20);
    }
  }
quaint mantle
#

wait are you manually removing the glow

#

or does it time out

lost matrix
#

Bukkit.getScheduler().runTaskLater(this, () -> glowManager.stopGlowing(player, entity), 20);

quaint mantle
#

because i want to make it permanent until i turn it off

#

sorry if i missed it because im on my phone out atm

#

so u turning the glow on makes it permanent until u turn it off?

glass mauve
#

I have a problem with loading images on a map, that is inside an item frame, that is send through a packet to a player, the item frame and setting is the item is fine, but I have problems with the map. It only works when I also add the map to the players inventory if not, than they spawn and despawn instantly:
main part: https://paste.ofcode.org/36FcpZFVjQwhV885veFCe2c
ImageRenderer: https://paste.ofcode.org/4VGrT3MbjT8gZ7FYSHq3NL
with add map to players inventory: https://www.youtube.com/watch?v=gbldtnt6Ojs
without: https://www.youtube.com/watch?v=Fg7q0iOQeSc

radiant cedar
#

how can I change the names of people in TAB and their names above their characters in game

lost matrix
radiant cedar
#

can also add colors like that

#

if i want it to look like this on tab and above their characters

radiant cedar
lost matrix
radiant cedar
#

what even is playerprofile

#

how do i set one for a player

earnest forum
#

player profile changes the name even for commands

radiant cedar
earnest forum
#

so if you change my name to yada1 instead of /tp yada0 you would have to do /tp yada1

earnest forum
radiant cedar
#

what

earnest forum
#

bit more complicated than that

radiant cedar
#

ya but it says this method

#

doesnt exist

earnest forum
#

because it doesntg

#

you have to get the nms player

radiant cedar
#

what is that

#

the hell

wet breach
#

if you don't know what NMS is probably shouldn't be touching it

lost matrix
# radiant cedar the hell

Do you want to change the players name all together?
So that he appears differently in other plugins, messages, etc too?

radiant cedar
#

when they join

#

i wanna change their name on their heads

#

and on the tab list

lost matrix
#

To achieve what?

radiant cedar
#

i already did the messages by just canceling mesage and sending new

radiant cedar
#

cus I want cool looking names i guess

#

idek

#

with ranks next to tehma

#

and colors

lost matrix
#

Ah thats a different story. You can achieve that by using prefixes and suffixes of teams.

quaint mantle
radiant cedar
#

would it be better idea to make a team for each rank

#

so they all have same prefix and suffix

wet breach
#

there is other ways of learning something without doing. You don't need to use NMS to know what NMS is.

#

did you also not understand java?

#

yeah for me they are one in the same anyways not arguing semantics here nor am I changing my stance 🙂

#

obviously you decided to learn the more difficult way, and either it has paid off or you learned some terrible habits. Either way, most others don't learn this way

#

I didn't say anything in regards to spigot

#

if you learn

#

if you don't learn something new from what you previously knew you don't progress

quaint mantle
#

How do I import the spigot sources in a maven project, so Intellij doesn't have to decompile everything when opening?

wet breach
#

anyways, I am going somewhere else. You are a terrible debater

quaint mantle
#

you are

#

lol

#

im not gonna debate over that

wet breach
#

nor accept their opinion

quaint mantle
#

omg

opal juniper
radiant cedar
#

I used this for their name on the TAB list

quaint mantle
opal juniper
undone axleBOT
radiant cedar
#

but how can I change their names on their heads

wet breach
#

at least this is how it is in netbeans

#

pretty sure it is something similar in IntelliJ

#

I am a netbeans fan

#

in case you didn't know 🙂

quaint mantle
#

oh yup

#

ty

wet breach
#

no

quaint mantle
#

definitely not, just look at eclipse

#

I've never used netbeans

wet breach
#

while intelliJ and netbeans are pretty similar in terms of functionality and could argue they are the same. They are still different because of how they both choose to organize their menus, what level of control over the IDE's they allow you to have as well as even though they have the same features how they are implemented are not the same.

quaint mantle
#

then yah

ivory sleet
#

tho zacken you do have a point, all ides do share a common set of features in order for them to be considered ides

#

and not just DEs or Code Editors

radiant cedar
#

why does this not work for setting the players' name above their heads to have a prefix

tardy delta
#

does it work on tab?

radiant cedar
#

i did something else for tab

#

i mean this is something i guess

#

but doesnt work on tab

radiant cedar
mighty pier
#

i want to start a bukkit runnable every time a player hits a player but if a bukkit runnable is already running how do i stop it?

tardy delta
#

any good recommendations for a command annotation framework?

lost matrix
tardy delta
#

i might give it a try

#

do i need to shade that?

ivory sleet
#

yuh

#

thats probably smart

radiant cedar
#

how could I use this API in my maven project

tardy delta
#

dumb question

radiant cedar
#

first time using maven

lost matrix
#

It takes a while to get used to. But if you understand all the internals then you
will write commands very fast.

tardy delta
#

good :)

lost matrix
radiant cedar
#

is there an easier way u know that I could use to setup the players' naems above their heads

mighty pier
mighty pier
#

like that?

#

the hashmap is uuid, bukkitrunnable

lost matrix
mighty pier
#

combat

#

you hit player

#

combat resets

#

that is part of the code

lost matrix
#

So you just want to have a combat timer?

#

To tag someone for being in combat?

mighty pier
#

yes

tender shard
radiant cedar
torn vale
#
        <!-- StatsAPI -->
        <dependency>
            <groupId>de.snx</groupId>
            <artifactId>statsapi</artifactId>
            <version>v1.2.6-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/StatsAPI.jar</systemPath>
        </dependency>```
Why cant I use the API?
tender shard
#

click the maven reload button

radiant cedar
tender shard
#

in the repository declaration

radiant cedar
#

doesnt work

tender shard
#

does work

#

wdym "doesnt work"? error message?

radiant cedar
#

com.nametagedit:nametagedit:pom:4.1.16 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
com.nametagedit:nametagedit:pom:4.1.16 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced

tender shard
#

click on the "m" button, then enter "mvn clean package -U"

radiant cedar
#

where is the m

#

button

tender shard
#

in the "maven" section

#

one second, I'll send screenshot

lost matrix
# mighty pier yes

Then you should only need one runnable.
When the player gets attacked -> Add a unix timestamp to their PDC

Then start one runnable when the server starts. This runnable goes through every player in 20 ticks
and checks the timestamp. If the timestamp is further than N milliseconds in the past you send them a message.

If you want to check if someone is being tagged as "in combat" then you just get their PDC and check the timestamp.

tender shard
radiant cedar
#

dont have this

tender shard
#

are you using intelliJ?

radiant cedar
#

yes

tender shard
#

then you do have this button

quiet ice
#

It should be on the right side

radiant cedar
tender shard
#

by default, on the right side, there's a bar called "maven"

radiant cedar
#

is this

tender shard
#

oh you're using a fucked up theme

#

well idk then

quiet ice
#

Probably is

radiant cedar
#

i did clean package

#

thingy

quiet ice
#

but wtf is this theme

tender shard
#

press "shift" twice, then enter "execute maven goal"