#help-development

1 messages · Page 1485 of 1

quaint mantle
#

bump

ivory sleet
#

Anyways new ItemStack[]{one} <-- is the correct syntax for declaring an array

quaint mantle
#

how can I set position in inventory

paper viper
#

ok so for some reason there is no way to get rid of the sound?

severe night
#

dope

tribal holly
#

there is not only the sound

#

there is also the potion particl break

severe night
tribal holly
#

i only want those black potions particles

quaint mantle
#

is spigot down again?

severe night
#

yep

quaint mantle
#

bruh

#

can someone help?

#

The method setOwner(String) from the type SkullMeta is deprecated

vale cradle
#

Note: Play an effect is not the same as spawn a particle

tribal holly
#

yes i see this

#

and i wanna only the particle nothing else

vale cradle
#

Then spawn the particle

quaint mantle
#

do I need to get verified to get support?

vale cradle
tribal holly
paper viper
quaint mantle
paper viper
#

to avoid the sound

tribal holly
#

yes i think to

vale cradle
paper viper
#

and that

quaint mantle
bleak reef
#

Alright so I appear to have just fixed this issue by removing a passenger on the armor stand (It was a dropped item [Barrier Block])
Is there any way I can still get it to teleport upwards with that dropped item as a passenger on the armor stand

paper viper
#

or you can use a particle library

#

but otherwise probably packets

vale cradle
#

What's your question?

quaint mantle
vale cradle
#

explain yourself better

#

what do you mean with set position in inventory?

quaint mantle
#
Inventory gui = Bukkit.createInventory(p, 27, color("&8&lGUI"));
ItemStack one = new ItemStack(Material.FEATHER);
ItemStack[] menu_items = {one};
gui.setContents(menu_items);
bronze hare
#
ItemStack one = new ItemStack(Material.FEATHER);
int slot = 3;
gui.setItem(slot, one);
#

basically sets the item at slot 3

severe night
quaint mantle
severe night
#

yeah, needs to be an offlineplayer object

paper viper
vale cradle
paper viper
#

you may be able to get away with this

quaint mantle
bronze hare
tribal holly
quaint mantle
paper viper
#

wait nevermind it got removed hm

vale cradle
severe night
bronze hare
severe night
#

@quaint mantle try this:

#

public ItemComposer(String url) {
        ItemStack skull = new ItemStack(XMaterial.PLAYER_HEAD.parseMaterial(), 1, (short) 3);
        if (url == null || url.isEmpty()) {
            this.item = skull;
            return;
        }
        if (!url.startsWith("http://textures.minecraft.net/texture/"))
            url = "http://textures.minecraft.net/texture/" + url;
        try {
            SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
            GameProfile profile = new GameProfile(UUID.nameUUIDFromBytes(url.getBytes()), null);
            profile.getProperties().put("textures", new Property("textures", 
                    new String(Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()))));
            Field profileField = skullMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(skullMeta, profile);
            skull.setItemMeta(skullMeta);
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.item = skull;
    }
quaint mantle
#

I'm trying to get first person from the list of admins and assign him this head in gui

lunar schooner
#

Getting a 521 Timed Out

severe night
lunar schooner
#

Check, thanks!

eternal oxide
#

its up

lunar schooner
#

yep just noticed

severe night
#

its up again oaskdoask

lunar schooner
#

Now I'm here, curious what you guy's opinions are on plugin metrics, in general, not the Plugin mcstats plugin etc

bronze hare
# quaint mantle

oh, i dont know if Bukkit.getOfflinePlayer(nickname) is still supported in 1.12
but try this to convert them to players (assuming they're online)

staffs.stream().map(Bukkit.getServer()::getPlayer).collect(Collectors.toList());
quaint mantle
#

i have a list of names

lunar schooner
#

I've worked on a metrics implementation over the weekend, curious what you guys would say for what to collect etc

quaint mantle
#

wait

glass mica
#

By is this alright I mean would it work

quaint mantle
#

this works but it just isn't showing that it works: metaSkull.setOwner(staffs.get(i));

bronze hare
bronze hare
quaint mantle
severe night
#

@quaint mantle try setting by the texture

quaint mantle
bronze hare
bleak reef
#

Is there any way to teleport an armorstand with a passenger,
eg.

ArmorStand armor = (ArmorStand) Bukkit.getWorld(p.getWorld().getName()).spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
ItemStack item = new ItemStack(Material.DIAMOND, 1);
Entity en = p.getWorld().dropItem(LocationB, item);
armor.addPassenger(en);

armor.Teleport(LocationC) // Not Working

//The above however works without the armor stands passenger
quaint mantle
#

thanks for help

stone sinew
#

have to set velocity for that

bleak reef
#

Ah alright, thank you

tribal holly
#
 PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(Particles.EFFECT,true,x+0.5,loc.getY(),z+0.5,255,0,0,0,0);
                    ((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);```
#

well still have white particle

#

any color

#

double register a listener ?

lunar schooner
tribal holly
#

yep

lunar schooner
#

Give me a sec to find the file 😄

tribal holly
#

because i can't change color particle with bukkit

lunar schooner
#

This one should help you

#

I use it to spawn coloured particles clientside

tribal holly
#

huuu not really

lunar schooner
#

How so?

stone sinew
#
public void registerListener(Listener l, Plugin p) {
    Bukkit.getPluginManager().registerEvents(l, p);
}

// registerListener(new InventoryClickEvent(), this);
```A bit cleaner. Also I might be wrong on the instance of listener.
lunar schooner
#

Since it does spawn coloured particles, which you were looking for right?

severe night
#

bro, use:

PluginManager manager = Bukkit.getPluginManager();
manager.registerEvents();

avoid repeated code.

tribal holly
#

i'm just trying to spawn a colored particle and don't even see in the code where it create the particlePacket

lunar schooner
#

Im on mobile, so I'll search for it but it might take a sec

tribal holly
#

ctrl +f into particle and nothing found

#

don't help me your code

lunar schooner
#

Sorry 😄

#

Keep in mind that I use reflection, so it might look a little different but the idea is the same

tribal holly
#

huu still don't understand

lunar schooner
#

You want the getParticlePacket method

#

Ill be able to help you more once I'm back at the desk 😄

tribal holly
#

i don't understand all your input

lunar schooner
#

Which ones have you got questions about?

#

I tried to model it at Bukkits spawnParticle

tribal holly
#

oX... extra & DustOption

lunar schooner
#

oX is offset X

tribal holly
#

i don't understand what difference with the NMS classic method

lunar schooner
#

extra I dont even know what it does, look at the bukkit docs for that, under World#spawnParticle or Bukkit#spawnParticle, not sure which

sick portal
#

Hi everyone, does anyone of you know if there is somesort of "pre-made" jenkins ci file to compile maven plugins ?

lunar schooner
#

DustOptions, check spigot docs for that

tribal holly
#

and how can it apply on potion particle

#

and not redstone

stone sinew
ivory sleet
#

Keep a reference to the BukkitRunnable

lunar schooner
#

I get the nms particle data in the method particleDataToNms

ivory sleet
#

Then just call Runnable#run

tribal holly
lunar schooner
ivory sleet
#

You might wanna show us how you did it

tribal holly
lunar schooner
#

That's what I do yup

ivory sleet
#

Sure and what is runnable declared to?

#

And that’s in onEnable?

#

It won’t run until the server is done loading

bronze hare
#

so can you not just do runnable.runTaskTimer(this, 0, 20) again?

tribal holly
#

where do you set the color ?

#

i do the same thing but it's always white

ivory sleet
#

If the task is already scheduled that is

tribal holly
#
PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(Particles.EFFECT,true,x+0.5,loc.getY(),z+0.5,255,0,0,0,0);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);```
#

haaaaaaaaaaaaaaaaaaaa

#

but i wanna send block particle

#

so 0 everywhere and still send white particle

#

0.0 ?

ivory sleet
#

Hmm Idr exactly how the CraftBukkitScheduler handles Runnable identities

#

But I know it’s only safe to schedule a BukkitRunnable once

tribal holly
#

i'm gonna kill my self

#

i'm 1.16

paper viper
#

Is he using 1.8..

#

Yeah he isnt

ivory sleet
#

Yeah it won’t repeat

paper viper
#

you need to call a different method for repeat

#

?jd

paper viper
#

one sec

#

lol

tribal holly
#

?

#

and which one ?

#

can't find any way to spawn colored potion particle

#

POTION

#

not redstone

paper viper
#

if you want repeat you have to use that

#

I dont think DustOptions works for potion?

#

on the javadocs

#

it said its for redstone specific

#

particles

#

Options which can be applied to redstone dust particles - a particle color and size.

ivory sleet
#

runTaskTimer PES_SadGePray

#

morice a solution would be to create a Runnable and delegate that one instead

sharp bough
paper viper
#

shh

#

conclure i cant read

#

lmao

ivory sleet
#

Lucas what is it for?

paper viper
#

I forgot about the delay

lunar schooner
sharp bough
#

dunno just found it and i was wondering if its worth it

#

i guess to storage data

#

like a buffer

paper viper
#

they all store data

#

lol

lunar schooner
#

For data storage id use sqllite

paper viper
#

oh what

glass mica
paper viper
#

same

glass mica
sharp bough
lunar schooner
#

For a buffer, depending on how long you're intending to store it for, I'd keep it in memory

glass mica
opal juniper
#

Am i right in saying that a HashMap can return null, but won't throw an exception if the key doesn't exist

glass mica
#

Even if I refresh

sharp bough
lunar schooner
sharp bough
#

does it have any pro or cons i should know?

opal juniper
lunar schooner
bronze hare
lunar schooner
#

Both are included in spigot

glass mica
sharp bough
ivory sleet
#

Okay so basically you’d have this instead:

class MainPluginClass is extends JavaPlugin {
  Runnable runnable = new Runnable() {
    @Override public void run() {
      //put the stuff that was in the BukkitRunnable run method 
    }
  };

  public Runnable getRunnable() {
    return runnable;
  }

  @Override public void onEnable() {
    this.getServer().getScheduler().runTaskTimer(this,runnable,0,20);
  }
}```

@last temple I believe that should fix it, key here is to use the BukkitScheduler
#

Also that code is crappy so don’t copy it literally

lunar schooner
# sharp bough wait snakeyaml is the yml file api to add docs and shit?

Snakeyaml is the library to interact with Yaml files, not sure which docs you mean but if its a yaml file, snakeyaml can do it.

Gson is for json, and the gson team have explicitly noted it will never support yaml, as its not ment for it.

Personally I use both in conjunction. I parse a config with snakeyaml, convert it to and from json with gson, then validate it with classvalidator and then use it

ivory sleet
#

I like yaml because it’s practically supports json also since it’s a superset of json

quaint mantle
#

how to close inventory?

sharp bough
#

thank you

sharp bough
paper viper
quaint mantle
#

thanks

ivory sleet
lunar schooner
paper viper
ivory sleet
#

Oh yeah right there

sharp bough
ivory sleet
#

Uh sure

#

Applied (:

ivory sleet
sharp bough
#

lol

ivory sleet
#

Uh but yeah use Runnable instead of BukkitRunnable and then use BukkitScheduler @last temple

sharp bough
#

right click and replace with lamba

paper viper
#

() ->

#

you can use lambda

#

() -> { }

#

you could store the schedualer as a BukkitTask

#

then call cancel on that

stone sinew
# tribal holly not redstone

loc.getWorld().spawnParticle(Particle.SPELL_MOB, loc, 0, dot.getColor().getRed()/255D, dot.getColor().getGreen()/255D, dot.getColor().getBlue()/255D, 1);

tribal holly
#

huu it really work ?

stone sinew
tribal holly
#

well ok

#

the color value still between 0 and 1 ?

stone sinew
tribal holly
#

okay thx

stone sinew
#

/255D

#

Redstone looks alot better though 😉

tribal holly
sharp bough
#

thats insane ahahhah

stone sinew
sharp bough
#

show me :c

stone sinew
#

Nah JK I convert a string to an image then convert the pixels to particles

tribal holly
#

it to warn a player of a toxic area

paper viper
#

just assign it to some variable

stone sinew
#

as long as its installed lol

paper viper
#

No

tribal holly
paper viper
#

like when you schedule the task

#

this.getServer().getScheduler().runTaskTimer(this,runnable,0,20); this part

stone sinew
sharp bough
stone sinew
sharp bough
tribal holly
#

full random color particle

lunar schooner
#

Thats an interesting one Yapper. You're converting a String -> Image -> Particles? I'm guessing spawning the particles based on XY positions in the image?

stone sinew
lunar schooner
#

Thats pretty interesting, definitely looking into that one soon

stone sinew
#

Uggg fuck that damn bot.

tribal holly
#
loc.getWorld().spawnParticle(Particle.SPELL_MOB, new Location(loc.getWorld(), x + 0.5, loc.getY(), z + 0.5), 2, 0, 0, 0, 1);
lunar schooner
#

If I may ask, what library are you using for Stirng -> image conversion? Or is it handmade code?

tribal holly
#

only change amount

#

he do it by him self i think

lunar schooner
#

Would be a fun project to make a library for this tbh

stone sinew
bronze hare
stone sinew
lunar schooner
digital rain
#

uhh guys for some reason if i export my plugin plugin.yml suddenly dissapears in the jar file

stone sinew
#

Look up "particle effect"

lunar schooner
#

First time I've seen it done with particles--Not that i've searched much but, interesting nontheless

stone sinew
tribal holly
#

but there is not enough particle

stone sinew
lunar schooner
#

That's going to be some heavy maths to get that to work for every degree 🤔

#

Definitely putting that on my TODO list

vale cradle
#

I think he used a 2d lib and then translated the coords

bronze hare
stone sinew
stone sinew
#

Someone give me a gif

lunar schooner
cold tartan
#

is there a way to keep inventory but only for potion effects?

lean escarp
quaint mantle
#

damn nice job

stone sinew
#

Its a gif so its slow AF

quaint mantle
#

i can feel the frames

deft geode
stone sinew
#

Oh wait I have a delay on the frames

#

its a tick per frame thats why

quaint mantle
#

ah try speed it up

stone sinew
#

Cant with how its coded... I would have to recode it

cold tartan
quaint mantle
#

couldn't you do it in a runnable

stone sinew
quaint mantle
#

and check if entity is instanceof Player

quaint mantle
jovial nymph
#

?paste

queen dragonBOT
stone sinew
quaint mantle
jovial nymph
#

can some one explain how send a pastebin into discord?

quaint mantle
jovial nymph
#

ok

stone sinew
quaint mantle
#

ohhh ok

#

try 20 frames per tick then? as that would look better?

jovial nymph
stone sinew
cold tartan
#

could someone help me? for some reason this doesn't work:

    @EventHandler
    public void onPlayerRespawn(PlayerRespawnEvent event) {
        Player player = event.getPlayer();
        PersistentDataContainer p = player.getPersistentDataContainer();
        NamespacedKey key = new NamespacedKey(Origins.getPlugin(), "Origin");

        if (p.has(key, PersistentDataType.STRING)) {
            switch (p.get(key, PersistentDataType.STRING)) {
                case "Burger":
                    player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(24);
                    player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 9, false, false));
            }
        }
    }
``` i don't get any errors, it just doesnt work
jovial nymph
#

can some one help me?

jovial nymph
#

13

jovial nymph
opal juniper
#

I need to broadcast a message, however i need to dynamically exclude one player, is this possible?

cold tartan
deft geode
#

Because “does not work” doesn’t give us enough info

cold tartan
deft geode
#

Yes

cold tartan
#

ok

opal juniper
#

is it possible to send a message from another player?

jovial nymph
#

wdym

opal juniper
#

as in as if they were typing it in the chat box

#

or do you just have to do the <name> hello

#

manually

jovial nymph
#

you could set a command that takes a player name to send with

#

and then just send it with this

cold tartan
# deft geode Yes

all of the breakpoints (one when event is called, one when first if statement is passed, and one when first case is passed) are reached

deft geode
#

So the player has the PDC value, and the switch statement executes

#

What is not working then?

paper viper
#

uh you cant

cold tartan
paper viper
#

then check the time between each frame to send

jovial nymph
stone sinew
cold tartan
# deft geode What is not working then?

this:

player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(24);

player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 9, false, false));
stone sinew
#

Its an old project I never finished

quaint mantle
stone sinew
#

just fun to play with

proper notch
paper viper
#

I got it working before but then it broke and idk why

#

and now i use name tags lol

jovial nymph
#

ok

#

but it seems the onCommand is the problem?

proper notch
urban grotto
#

I'm real tony stark

proper notch
#

oh well then u can

#

erm

cold tartan
quaint mantle
#

Hey there, is it a right way to get a skull item with a specific skin in 1.8 api? i tried but it didn't work

private ItemStack getPlayerHeadItem(Player player, int count, String title) {
        ItemStack item = new ItemStack(Material.SKULL_ITEM, count);
        SkullMeta meta = (SkullMeta) item.getItemMeta();
        meta.setOwner(player.getName());
        meta.setDisplayName(Utils.colorify(title));
        item.setItemMeta(meta);
        return item;
    }
cold tartan
deft geode
cold tartan
urban grotto
#

can you send error message

deft geode
#

Delay it by a tick or two

quaint mantle
cold tartan
urban grotto
jovial nymph
quaint mantle
cold tartan
#

YAY

sage swift
#

anytime after the respawn event is fine

cold tartan
jovial nymph
urban grotto
stone sinew
#

@paper viper

cold tartan
jovial nymph
jovial nymph
stone sinew
#

I would have to change alot of shit to make it work better today cause when I originally coded it, I wasn't carrying about performance xD

#

Literally just spams a shit ton of particles

paper viper
#

that not resuming

#

thats creating the task again after its cancelled lol

paper viper
#

kek

deft geode
jovial nymph
#

does someone knows a good tutorial on how to get customHeads from minecraft-heads without theire database or should i use the data base?

deft geode
#

Or minecraft-heads api lol

jovial nymph
#

ok i just use the api(database)

deft geode
#

Why would you not use the API?

#

It's a literal web API doesn't get easier than that

jovial nymph
#

the database(how i learnd it) is just a set of data that i can acces with pw and account name so my data is secure but for this i think its just to organize the heads

deft geode
#

I'm lost

#

The web API makes database backend calls for you - you're never connecting to the database

glass mica
#

Anyone experienced with https://api.spigotmc.org/legacy/update.php?

deft geode
#

It's as secure as can be and you don't even need a key

jovial nymph
#

sry they even dont use a db its just calld database

deft geode
#

??? you're so confusing

#

Explain why you'd rather not make calls to their web api to get heads

jovial nymph
#

but to explain it to you if you have a website where someone can login and register an account you need to save their password and name somewhere where it can not be accesd easily

deft geode
#

Databases do a good job of that? Not to mention, passwords aren't stored as plain text they're hashed

#

I don't understand how that relates to you calling a web api

jovial nymph
#

i know mdn5

deft geode
#

because the minecraft-heads api does not need you to sign in

jovial nymph
#

sry i thought they use a database on the server where all heads are saved beacause there api name contains database

deft geode
#

They do use a database on the server where all heads are saved
Why wouldn't they and why is that a bad thing

digital rain
#

ok hi guys, does anyone get what value does this want? can i give it a list of itemstacks?

deft geode
digital rain
#

oh okay

jovial nymph
#

there must be miss understanding the they probaly use a database on there server

digital rain
#

ty

deft geode
jovial nymph
#

@deft geode nothing i knwo your right i just miss understood something

deft geode
jovial nymph
#

can we talk about it maybe because typing is really hard

cold tartan
#

is there a way to run something every x ticks?

coral sparrow
#

What does Getservername return to

#

lol

deft geode
#

lord

stone sinew
#

Its fun though because I made it all configurable.

coral sparrow
#

Does anyone know what getServerName return to

deft geode
#

Javadocs exist

coral sparrow
#

Is there a name for a server lol

#

Bungee?

proper notch
#

What getServerName method is this?

deft geode
#

it returns a string of the server name

coral sparrow
deft geode
#

aKa the implementation

deft geode
coral sparrow
#

ye

deft geode
#

Javadocs, please check them

coral sparrow
#

is it from server properties or smt

coral sparrow
# deft geode

as if I didnt knew that, I am just confused where do we input the server name

deft geode
#

aka spigot, bukkit, paper

jovial nymph
# cold tartan is there a way to run something every x ticks?

yeah like this ```
private BukkitRunnable runnable;
runnable = new BukkitRunnable() {
@Override
public void run() {

           // your code
            }

//and than start it with
runnable.runTaskTimer(your plugin, 0/delay between/, 20/how long you want the period to be/);

deft geode
coral sparrow
#

ye

deft geode
#

Let me just zoom in further

jovial nymph
#

@quaint mantle where did you go?

vast depot
vale cradle
#

I see you using kotlin

#

+1

vast depot
#

Kotlin is far superior

vale cradle
#

Ofc

#

Nobody can disagree :^)

opal juniper
#

I wanna learn it

#

How different is the syntax?

vale cradle
#

A lot more pragmatic

vast depot
#

Not massively different. ```java
public class Main extends JavaPlugin implements Listener {

@Override
public void onEnable() {
this.getPluginManager().registerEvents(this, this);
}

@EventHandler
public void onChat(AsyncPlayerChatEvent event) {}
}```

class Main : JavaPlugin(), Listener {

  override fun onEnable() {
    this.pluginManager.registerEvents(this, this)
  }

  @EventHandler
  fun AsyncPlayerChatEvent.onChat() {
    // this is an extension function. P.S these are amazing
    if(this.message.content.equals("poo", ignoreCase = true)) isCancelled = true else isCancelled = false 
  }
}```
fickle helm
#

looks like a lot of fun

vast depot
#

Anyways if anyone has any ideas for #help-development message please ping me, been trying to work this out for a few days now, looking into EntityHorseAbstract & EntityPig has not helped much

vale cradle
vast depot
#

Realistically you'd just create a new EventBus system that is wrapped nicely over Spigots

vale cradle
#

Is worth learning it

jovial nymph
#

anyone know how to use the minecraft-heads api with bukkit?

vale cradle
#

I have a Framework to work with kotlin on Spigot

#

Lot of those stuff

quaint mantle
#

Any benefits for using packets and nms to create scoreboards?

vast depot
#

Packets & NMS tends to be messy avoid it where possible

jovial nymph
#

if you use it

quaint mantle
#

I get it that it’s pain in the ass but why do developers use it? Like FeatherBoard

jovial nymph
#

so does anyone has an idea or answer to my question

vale cradle
jovial nymph
#

yeah sort of

jovial nymph
vale cradle
#

Learn how to use apis, and your question will be answered by yourself

jovial nymph
vale cradle
#

Advice: do it async, you wouldn't want to stop your whole server when retrieving info

jovial nymph
#

ok

proud basin
#

If I do java if (args[0].equalsIgnoreCase("test") && args[1].equalsIgnoreCase("no") || args[1].equalsIgnoreCase("yes")) I would get a out of range correct?

chrome beacon
#

Well that depends if the command contains the args

#

But yes if it doesn't

opal juniper
#

Can i specify a hex colour

#

eg

#

ChatColor.fromHex("Hex")

#

?

eternal night
#

bungeecord's chatcolor has support for those

#

tho hex will only be available in TextComponents afaik

sage swift
#

sex components

#

no you can do it anywhere

opal juniper
sage swift
#

but you need to use bungee ChatColor.of

opal juniper
#

ah ok

eternal night
#

the legacy strings allow for hex colours ?

sage swift
#

yes

opal juniper
#

would it be like this?
net.md_5.bungee.api.ChatColor.of("#c999ff")

ivory sleet
#

That works

opal juniper
#

ok thanks

vast depot
proud basin
#

Odd the args are there and correct caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 java if (args.length > 0) { #this line if (args[0].equalsIgnoreCase("test") && args[1].equalsIgnoreCase("no") || args[1].equalsIgnoreCase("yes")) { // Other stuff } }

#

I'm doing /mycommand test yes

coral sparrow
#

I think you shoudnt "or" the args[1] with args[0]

#

Just check again in the args[0]

ivory sleet
#

If you use args[1] then you should check args.length >= 2 before

coral sparrow
#

the args[0] must work

opal juniper
#

I have a map of String : String, how can i load this everytime (it does not need to change )

ivory sleet
#

Elaborate

proud basin
coral sparrow
opal juniper
#

sorry, should have pasted it

queen dragonBOT
ivory sleet
#

I mean you could do it with code

eternal night
#

The java Locale class is crying

opal juniper
#

hahaa

proud basin
ivory sleet
#

Although if you wanna cutdown verbosity might wanna use ImmutableMap.<String,String>builder() which would cut down verbosity somewhat

eternal oxide
coral sparrow
opal juniper
glass mica
#

I need small help

opal juniper
#

yep

#

i have used it b4

#

what do you need help with

ivory sleet
#

You need to add the resourceId

glass mica
#

I know that

eternal oxide
opal juniper
glass mica
#

My current plugin version is 1.0, but it only says the plugin is up to date if I put 0.8 in plugin.yml.

#

So that's like weird

opal juniper
#

thats all it checks for

#

wait hang on

#

i just read it properly

eternal oxide
#
getConfig().set("language", languageCodes);
languageCodes = (Map<String, String>) getConfig().get("language").getValues(true);```
opal juniper
#

i have found in the past that the api is slow to update

glass mica
#

Last time I tested it was few hours ago

#

I'll test again and see

cold tartan
#

im getting this error but im not sure why:

java.lang.IllegalArgumentException: advancement
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[patched_1.16.5.jar:git-Paper-714]
        at org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer.getAdvancementProgress(CraftPlayer.java:2023) ~[patched_1.16.5.jar:git-Paper-714]
        at com.defiantburger.origins.Origins.lambda$onEnable$0(Origins.java:40) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-714]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-714]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1426) ~[patched_1.16.5.jar:git-Paper-714]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:419) ~[patched_1.16.5.jar:git-Paper-714]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1341) ~[patched_1.16.5.jar:git-Paper-714]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1129) ~[patched_1.16.5.jar:git-Paper-714]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-714]
        at java.lang.Thread.run(Thread.java:831) [?:?]
#

the lines it has issues with are these:

NamespacedKey adkey = new NamespacedKey(Origins.getPlugin(), "husbandry/balanced_diet");
Advancement a = Bukkit.getAdvancement(adkey);
AdvancementProgress aprog = player.getAdvancementProgress(a);
ivory sleet
#

Pace I think it works all good but as Jeff said the web api might not be the fastest

opal juniper
eternal night
#

pretty sure that exception is thrown if the advancement is null

cold tartan
#

yeah, thats the issue, but i dont think it should be null

eternal night
#

dunno what to tell you there xD ¯_(ツ)_/¯

cold tartan
#

hmmmmmmmmmmmmmmmmmm

opal juniper
#

@glass mica , use the method like this:

        new updateChecker(this, VERSION).getVersion(version -> {
            if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
                boolean isold = isOutdated(this.getDescription().getVersion(),version);
                if (isold) {
                    getLogger().info(ChatColor.LIGHT_PURPLE + "There is a new Update Available for Plugin: Version " + version);
                }}
        });

https://paste.md-5.net/lurucohojo.js

ivory sleet
#

That’s practically equivalent to what he did

glass mica
#

I'll try thanks 👍

#

But take a look at this

#

This is my current method;

opal juniper
glass mica
#

Look at those 4 screenshots

opal juniper
#

look at this:

#

the api returns newest as 0.8

glass mica
#

huh

opal juniper
#

nothing wrong with ur code

#

check the id didn't change or sommin 🤷

glass mica
#

Is the same

#

@opal juniper

worldly ingot
#

The API caches values for up to 6 hours

glass mica
opal juniper
#

well there you go

glass mica
#

So I'm guessing in 6 hours it should be fine?

worldly ingot
#

Yes

glass mica
#

Thanks

worldly ingot
#

(It might be 8, but I think it's 6)

opal juniper
#

heyya @eternal oxide

#

not exactly working ><

worldly ingot
#

Surround the cast appropriately, but don't you want getConfigurationSection()?

opal juniper
#

🤷

#

i hate configs

worldly ingot
#

What's your config look like? I missed your earlier question

#

(at least the relevant part of it)

opal juniper
#

tryna store a (constant) hashmap of String : String to be able to load it each time

#

instead of just a verbose setting each load

#

the map^^^

worldly ingot
#

gotcha. I'm not positive what the result of set(Map<String, String>) does, but if it does manage to miraculously return a Map<String, String>, you want to cast the result of get(), not getValue()

#

((Map<String, String>) getConfig().get("language")).getValues(true)

#

LivingEntity#getTargetBlock()

#

Or getTargetBlockExact() which takes into account bounding boxes

eternal oxide
#

If you just added to the config and saved without reloading, the Map will be in the config. If you reload the config ti becomes a MemorySection.

#

So if you have not loaded yet it is still a Map so your get will return the map.

#

If you Have loaded it will be a memory section so you then need .getValues(true)

opal juniper
#

ummm wdym by 'loaded'

#

sorry

eternal oxide
#

config.load

#

FileConfiguration converts Maps into MemorySections upon loading

#

So if you added your Map to the config and saved, In memory it will still be a Map

#

so getConfig().get("language") would return a Map.

opal juniper
#

ah

eternal oxide
#

However, if you restart or reload your config it is converted into a MemorySection, at which point the get returns a MemorySection and you have to get the Map from it with getValues(true).

#

one sec I did write a simple wrapper

opal juniper
#

oke

eternal oxide
#
    /**
     * If loading from file the Maps in the data
     * will be stored as a MemorySection not Maps.
     * 
     * @param entry    MemorySection or Map to check.
     * @return        Map containing the serialised data.
     */
    @SuppressWarnings("unchecked")
    protected Map<String, Object> castToMap(Object entry) {

        if (entry instanceof MemorySection) {
            return ((MemorySection) entry).getValues(true);
        } else {
            return (Map<String, Object>) entry;
        }
    }```
#

just throw your get("language") through that method

digital rain
#

any idea how to check if the item has no enchantments? since im doing some weird stuff 🥴

#

since null doesnt work, neither does str as "{}" or ""

sullen dome
#

does Bukkit#getPluginCommand only include commands from my own plugin, or minecraft commands like /gamemode too?

eternal night
#

pretty sure you just check if the ItemStack#getEnchantments map is empty

#

to figure out if an item has enchants

wispy dagger
#

Anyone know a way I can simulate uuid spoofing, but in a plugin? Just set a players uuid to something else

eternal oxide
#

Why? I ask as we will not help write trojans

sage swift
#

i will not

eternal oxide
#

lol

opal juniper
wispy dagger
eternal oxide
#

It would emable you to spoof any player on any server with yoru plugin. Thats a backdoor/trojan

wispy dagger
#

Ah yes, it would be if I was planning to do that

eternal oxide
#

Which is why I asked.

ivory sleet
#

👀

wispy dagger
#

Also, if I wanted to write a trojan I could literally just get one to op me, why would I need a uuid spoofer

opal juniper
#

what is the method of loading a resource from the jar?

wispy dagger
#

How is it less obvious

opal juniper
#

than opping you? a lot!

eternal oxide
#

You are unlikely to get help to learn how to do that without a solid reason, other than curiosity.

wispy dagger
opal juniper
#

ok

eternal oxide
#

being oped would appear in the logs, and notify other ops

wispy dagger
opal juniper
#

so if a server owner acts funny that is less obvious than a random guy going round and blowing shit up

#

well, there is this ig

vagrant stratus
opal juniper
#

true ^^

eternal oxide
#

Sorry, I'm out I'll not teach possible exploits with a good reason for need to know it.

wispy dagger
wispy dagger
ivory sleet
#

I mean GeometryPro if someone’s willing to help you then they will, just be patient 🙂

wispy dagger
#

Im being patient, just responding to this random guy telling me I'm writing Trojans lol

opal juniper
#

There was a guy a while back asking for the same info

#

lemme find him

#

ok

#

its Pixel#5000

#

ask him about it and if he got anywhere

#

but don't be spammy / annoying

eternal oxide
#

random guy 🙂

opal juniper
#

ok so this is probs stupid but i have never done async b4

ivory sleet
#

Didn’t you mess with that the other day?

opal juniper
#

soooo, i am listening to the AsyncPlayerChatEvent - how do i make the other stuff async

#

yuhuh

#

still going

ivory sleet
#

Other stuff?

pseudo raptor
#

I need help on a type of verification system. The plugin I'm doing at the moment, itself consists of an enchant system. When the player types /enchant, it will open a menu that he will be able to choose the enchantments. But I want the player to only be able to use the system if in his inventory he has some certain items. So far I've made a Class with all the items I want to appear in the verification, but I don't know how to continue.
[Google translator]

sage swift
#

Inventory#contains

pseudo raptor
opal juniper
# ivory sleet Other stuff?

well, it makes an api request using a method and that api request method uses a different class to make the parameters

pseudo raptor
#

but how do I do with super simple codes (if possible).

opal juniper
#

i can show the method

sage swift
#

contains(item1) && contains(item2)

#

magical stuff right there

ivory sleet
#

I mean usually methods are call sensitive, but what was the issue Jeff?

opal juniper
#

i just needed to know that it was actually working async, cause some1 moaned cough cough LEOcab about it not being async

#

and idrk if it is - tps effect and all

pseudo raptor
opal juniper
#

?paste

queen dragonBOT
sage swift
opal juniper
ivory sleet
#

Jeff where’s getTranslation called

opal juniper
#

In the async chat event listener - sorry

ivory sleet
#

Then everything is async

#

Or at least what you sent me is being executed on another thread than the server thread

#

99%

#

I believe it might be called synced if and only if a plugin triggers the chat event synchronously

opal juniper
#

oh ok that makes sense

ivory sleet
#

But that would be a trivial fix

opal juniper
#

it doesnt matter to me tbh

ivory sleet
#

Aight

opal juniper
#

i just wanted to check that with a large player base main thread wasn't gonna get bogged down

#

with api requests

ivory sleet
#

Nope although I guess it might delay chat

#

So implementing a cache system could be beneficial here

opal juniper
ivory sleet
#

O nice

opal juniper
#

yeah its pretty sweet

#

ok, thanks

cold tartan
#

intellij says that it cant find net:

import net.minecraft.server.v1_11_R1.EntityZombie;
opal juniper
#

you are using the wrong nms version

cold tartan
#

oh

#

what version?

opal juniper
#

what version spigot api are you using?

cold tartan
#

1.16

opal juniper
#

.5?

cold tartan
#

yeah

opal juniper
#

import net.minecraft.server.v1_16_R3.EntityZombie;

cold tartan
#

still couldnt find it

eternal oxide
#

Using maven?

cold tartan
#

wdym

eternal oxide
#

does your project use Maven or Gradle to build?

cold tartan
#

gradle

#

i think

#

how would i check?

eternal oxide
#

are you depending on spigot or spigot-api?

cold tartan
#

im not sure what you mean

#

how would i check?

#

oh wait

#

dependencies

eternal oxide
#

look in your gradle build?

cold tartan
#

spigot-api

eternal oxide
#

change that to spigot. the api has no nms classes

cold tartan
#

oh

#

ok

#

where would i find that?

eternal oxide
#

you obtain spigot by running buildtools

#

?bt

queen dragonBOT
opal juniper
#

What is the way to make a string title case

#

ideally:

hello people -> Hello people

cold tartan
eternal oxide
#

no

cold tartan
#

what do i do with them then?

eternal oxide
#

Nothing, running BT will have installed spigot into your local maven repository

cold tartan
#

so what do i do to get them functioning in intellij cuz they arent atm

eternal oxide
#

You should now be able to change the entry in your maven or gradle build script to use spigot instead of spigot-api

cold tartan
#

ok

vast depot
opal juniper
smoky vapor
#

Hello. I'm working with the Text class to set my HoverEvent. How would I add colour to the Text class?

// TextComponent broadcast = new TextComponent("Broadcast");
broadcast.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("") /* <- How to add colour with new Text()? */));
#

Because new HoverEvent() with BaseComponent/new ComponentBuilder("Text").create() is deprecated.

rotund ravine
#

Use the ComponentBuilder

#

Can't remember the exact name

smoky vapor
#

@rotund ravine It's deprecated use of it

smoky vapor
#

Maybe it's not possible? If that's the case, then why is it deprecated? Does it mean that HoverEvent text can't have colour anymore?

wraith rapids
#

oh you're redoing that translation plugin huh

#

i remember there being one that used google's translation api but that requires api keys and shit now so that died

#

it was pretty nice

smoky vapor
#

?

#

It's not related to Google at all.

wraith rapids
#

@opal juniper

opal juniper
#

Ahh yep im still here

#

it does still require an api key - but imma use deepl

wraith rapids
#

make it public

opal juniper
#

it gives you 500k chars a month free

wraith rapids
#

half of my playerbase is from like east asia for some reason

opal juniper
#

i will its not done yet tho

#

wait, you have a server?

wraith rapids
#

does it translate everything to a global language

opal juniper
#

atm yes

wraith rapids
#

or everything on a per-player basis to each player's own language

opal juniper
#

russian to english example

#

i would like to add per player but the amount of api requests would get pretty high

#

also, deepl has this weird issue with capital letters

wraith rapids
#

neural networks are dumb

opal juniper
#

so i am having to lowercase everything and then uppercase it

#

but it screws up things like shouting

wraith rapids
#

mmm

#

per-player should still be fine as long as every player doesn't use a different language

opal juniper
#

exactly tho

#

also, it doesn't work if you were to type hola

#

it just translates it to english as hola eventhough that is definitely not english

wraith rapids
#

i'd just use the player's selected locale instead of some enermous language detection library

opal juniper
#

wait how does that work

#

im dumb as hell

wraith rapids
#

Player::getLocale

opal juniper
#

i didn't realise that was a thing

wraith rapids
#

i thought you said "you don't want to use api for it"

#

so I assumed you knew about it

opal juniper
#

yeah - detecting the language of the text incoming

wraith rapids
#

but basically, the client sends some of its settings to the server

#

render distance and locale are few notable examples

#

the server can see the language the player has selected

opal juniper
#

yeahhhh, i get you

#

what, and then for each language being used, ->

translate it
send it to all players with that locale

??

wraith rapids
#

something along those lines

opal juniper
#

thats an interesting idea

wraith rapids
#

that's what the plugin I mentioned earlier did

#

which was what made it so good

opal juniper
#

That is a really good idea

#

what do they do when the client has selected a lang that isn't supported

wraith rapids
#

nothing, I suppose

opal juniper
#

makes sense

#

huh, i may add that

#

like, either global or per player (locale)

#

when i was talking about not using an api - i was talking about the detection of the language i am using in order to save on requests

#

ie - if it is already in the correct language dont change it

#

just making sure - can you translate without an api?

wraith rapids
#

no

#

not even translatable components

opal juniper
#

yeah thats what i thought

#

hmm

wraith rapids
#

the server only bundles in the en_us language mappings

opal juniper
#

if only everyone just spoke english

#

(natively)

wraith rapids
#

we'll all speak chinese natively eventually

opal juniper
#

lmao

#

well, thanks for the idea then. i will try that at some point

#

i think that a global language is still good for smaller servers who want to preserve their api requests

#

but, if you are gonna pay for it, why not go all out

wraith rapids
#

have a setting to cycle through several free api keys

#

why pay anything when you can just have 10 keys

opal juniper
#

omg this guy too smart

#

nah im not gonna do that lmao

wraith rapids
#

i'll fork it and add that functionality

opal juniper
#

lmao - the large corperations have too much money anyways branch

wraith rapids
#

imagine paying google a single penny

#

fucks are already making money off of my private data

granite stirrup
opal juniper
#

i mean, afaik i don't let them take my money

#

but yes, my data is a different story

#

they just take it

#

ElgarL showed me the other day

#

its really cool

wraith rapids
#

looks useful

eternal night
#

and produced this ^

#

still salty that we do not have a way to load any type of jar 😭

wraith rapids
#

"muh security"

opal juniper
#

i mean, i have to use it for the lang detect lib cause that shit 120 MB

#

but, i can see it being adopted fast

eternal night
#

I mean, it works well still with just your own URLClassLoader

opal juniper
#

yeah but im too dumb to write that

#

so ill just use the one that some1 else wrote 😎

wraith rapids
#

library plugins are dumb

#

why does it have to be a plugin

#

just make it a library

opal juniper
#

oh right

#

i mean

vagrant stratus
#

Certain ones might need initializing of some kind or something along those lines @wraith rapids

opal juniper
#

im sure optic will enlighten us

#

there we go

#

that makes sense

eternal night
#

I mean, libraries should be initialised by the user no ?

opal juniper
#

or that actually

eternal night
#

and the library feature only allows you to use maven central

#

so like

#

¯_(ツ)_/¯

vagrant stratus
#

I mean like field's and stuff @eternal night

eternal night
#

how does initialising fields etc justify it being a plugin o.O

torn oyster
#

why was i recommended that

opal juniper
#

lmao

wraith rapids
#

certain ones are dumb @vagrant stratus

opal juniper
#

red lib is amazing

#

❤️

vagrant stratus
eternal night
#

overloaded blob xD

wraith rapids
#

needs fewer .txt files

#

kindly ask it to stop

#

give me reddit gold

opal juniper
#

'Please, don't execute this'

wraith rapids
#

i don't know what you mean by going to console

#

do you mean logged?

opal juniper
#

i think he means from being executed

#

oh im wrong

wraith rapids
#

uh

opal juniper
#

nvm

wraith rapids
#

add a log handler i guess

stiff topaz
#

when a user runs a command

wraith rapids
#

i don't think there is a better way

quaint mantle
#

Yes

#

Go to spigot.yml

granite stirrup
#
please make command named "hello" and set executor to commandHello
please make executor commandHello with permission "command.hello" that executes:
  if player is not a instance of console do:
    please say hi to player
please end executor``` imagine this was a language
#

lol

quaint mantle
#

Set the log to false

quaint mantle
#

Then restart the server or do /spigot reload

granite stirrup
#

no

granite stirrup
#

dont use /reload /spigot:reload /reload confirm /bukkit:reload or neither

#

only restart the server

#

dont use the commands

quaint mantle
granite stirrup
#

lol

opal juniper
#

but that doesn't help that much

quaint mantle
#

It helps me alot

opal juniper
#

ohk

wraith rapids
#

spigot.yml is not the developer's place to toggle settings arbitrarily

quaint mantle
#

I use commands.yml so much so when i want to reload it i just use /reload commands

wraith rapids
#

that's the end user's configuration file

vagrant stratus
wraith rapids
#

i haven't heard of bukkit having subcommands for reload

opal juniper
#

so, Player::getLocale() returns a string of the currrent locale, is there a list of all of the codes?

smoky vapor
granite stirrup
#

commands.yml doesnt even let u make actual real commands it only lets u make commands that does other commands

quaint mantle
#

Im not sure

wraith rapids
#

they're standard-ish country language codes

#

en_US and whatnot

opal juniper
vagrant stratus
quaint mantle
granite stirrup
#

why would u disable default mc or bukkit commands

quaint mantle
opal juniper
eternal oxide
#

links inside <> will not do the preview

opal juniper
#

god damm you NNYaKNpGms0eUVpiSdHx, i gotta sort thru these

wraith rapids
#

the preview is fine

quaint mantle
wraith rapids
#

i don't understand why everyone is sperging out about the embeds

eternal oxide
opal juniper
#

i just either leave them or delete them

#

hahahaa

#

idm them, but they can be a bit big

#

like that one was too big so i deleted it

#

cause it just clogs up the chat

opal juniper
#

nahhh really

granite stirrup
#

minecraft wants to be for every language

#

and some of the languages are jokes tho

opal juniper
#

mf pirate is not a joke

granite stirrup
#

like the pirate lang

granite stirrup
wraith rapids
#

i unironically use pirate speak

granite stirrup
opal juniper
#

shiver me timbers

granite stirrup
#

lol

opal juniper
#

oh so the first bit is the lang and the second the dialect

#

so i just need to sort by the first bit

wraith rapids
#

the not jokes are mostly in accordance with country language codes

granite stirrup
#

yeah but the pirate one is a joke

#

cuz no one speaks pirate

#

XD

opal juniper
#

wait minecraft doesn't do japanese?

granite stirrup
#

idk

wraith rapids
#

idk maybe they're raycist

granite stirrup
#

it does i think

#

yeah it does

#

cuz i saw it

opal juniper
#

spelt it wrong ><

granite stirrup
#

XD

#

how tf could u do that

#

its legit Japan and ese

#

XD

opal juniper
#

cool

#

now i need to make a method that takes the locale, translates it to the api version or nothing

wraith rapids
#

what does the api use for language codes anyway

#

you'd think they'd use the standard country language codes as well

opal juniper
#

nope

wraith rapids
#

isn't that the iso country code

opal juniper
#

idk

eternal night
#

yes

#

yes it is

opal juniper
#

there ya go then

eternal night
#

its just plain ISO 639-1 codes

#

what kind of language API would invent their own xDD

wraith rapids
#

yeah i was thinking google surely wouldn't be such a noob

opal juniper
#

🤷

eternal night
#

oh I thought they were using deepl

opal juniper
#

yuhuh

wraith rapids
#

oh right, deepl and google aren't the same

#

well, still

opal juniper
#

i hate regex

#

what is it to split :
sw_E into the two parts

eternal night
#

why regex for that o.O

opal juniper
#

oh i thought it had to be

#

just ("_") then?

eternal night
#

I mean, the string will be compiled to regex internally I believe

#

but what is the issue o.O

opal juniper
#

there isn't - i just thought i had to use regex

#

as in - more than that

eternal night
#

well that is valid regex

#

and matches any, well, underscore

opal juniper
#

fair

#

ok

#

how can i just initialise a set

wraith rapids
#

new HashSet

granite stirrup
#

powerpoint is a game engine :)

opal juniper
#

like set = {"hello", "jefff"}

#

yeah