#development

1 messages · Page 115 of 1

sharp cove
#

What?

#

That is not what i mean.

#

If i have 6 players online

#

And i have for example 3 teams

#

I want 2 people per team

proud pebble
#

ah the max teams is set else where

sharp cove
#

there is no max you know

#

people can set the amount of teams in the config

proud pebble
#

exactly

#

the maximum amount of teams is set in your config

sharp cove
#
#The settings for the teams. (CASE SENSITIVE)
Team_Settings:
  Rood:
    Name: 'Rood'
    Prefix: '&7[&cRood&7]'
    Tab: '&7[&cR&7] &c'
    Display: '&cRood'
    Block: 'REDSTONE_BLOCK'
    Title: '&7Team &c&lrood'
    Slot: 10
    Lore:
      - '&7'
      - '&7Klik hier om team &cRood &7te joinen!'
  Blauw:
    Name: 'Blauw'
    Prefix: '&7[&9Blauw&7]'
    Tab: '&7[&9B&7] &9'
    Display: '&9Blauw'
    Block: 'LAPIS_BLOCK'
    Title: '&7Team &9&lblauw'
    Slot: 13
    Lore:
      - '&7'
      - '&7Klik hier om team &9Blauw &7te joinen!'
  Groen:
    Name: 'Groen'
    Prefix: '&7[&2Groen&7]'
    Tab: '&7[&2G&7] &2'
    Display: '&2Groen'
    Block: 'EMERALD_BLOCK'
    Title: '&7Team &2&lgroen'
    Slot: 16
    Lore:
      - '&7'
      - '&7Klik hier om team &2Groen &7te joinen!'```
#

Yes

#

Now you see how en what

proud pebble
#
int teammax = config.getteams.size();
int playerarrayslot = 0;
int teamnum = 0;
boolean finished = false;
while (!finished) {
  if (teamnum == teammax-1) {teamnum = 0}
  teams.putplayer(queuedPlayer[playerarrayslot],teams.getTeamname(teamnum));
  if (playerarrayslot == queuedPlayer.length+1) {
    finished = true;
  }
  playerarrayslot++;
  teamnum++;
}
#

@sharp cove something like this.

#

this works if you dont set a players team right when they join the game

sharp cove
#

Damn

#

Thanks man

atomic trail
#

Havn't made plugins in a while, if I create a 1.18.1 plugin I need to build it with java 17 right? Or is it just server-sided at runtime

steady ingot
#

Well you don't have to, but there's no reason not to (unless you want backwards compatibility)

proud pebble
#

if your using the mojang mappings for nms stuff then you would require 17

steady ingot
#

^

proud pebble
#

if your using a newer java feature such as multiple arguments in switch cases then it would be either 11 or 14

#

i cant remember

atomic trail
#

But if I build it using java 17, all servers that run it need java 17 right? Or do they also need java 17 for servers in 1.18.1 even if I built the plugin using Java 11?

proud pebble
#

case string1,string2:
instead of

case string1:
case string2:  
steady ingot
#

Ik that in Java 11 you can create immutable lists, so I've been using J11 instead of 8 when I have to use Java

atomic trail
steady ingot
#

Mc 1.18 requires Java 17 anyway

proud pebble
#

if you build your plugin against java 17 then servers would require that too

atomic trail
steady ingot
#

Server side

proud pebble
atomic trail
#

Oh

#

alright

#

thanks both of you

steady ingot
#

Though clients should automatically have it installed

atomic trail
proud pebble
#

i remember the days before mojang included java in their launcher

atomic trail
#

Paper's new way to download the API is so confusing lol

#

For some reason IntelliJ can't set it up automatically

lyric gyro
#

what....

#

mate that's the paperclip jar you use to run a server

atomic trail
#

tf

#

But

lyric gyro
#

downloads API

#

not Paper API as in the server api

atomic trail
#

Oh bruhhhh

lyric gyro
#

the API endpoints to download jars

#

this is what you want.. lol

atomic trail
#

Where's that?

lyric gyro
#

hover your cursor over "documentation"

atomic trail
#

ofc... Oh my

#

It's been too long since I used paper lol

#

So it's not destroystokyo anymore?

steady ingot
#

Nope. They moved from 1.17 iirc

atomic trail
#

IntelliJ still thinks it's destroyerstokyo for some reason

spiral prairie
queen plank
#

I want to copy a block and include the meta data. But I don't get how it works and google isn't very helpful. What I found is what I already knew, "Add a string and a boolean". What do they do though, and how do I use them?

dense drift
lyric gyro
#

1.9.4 😵‍💫

#

there was no Sound class ????

#

nvm i'm looking in the cb repo lmao

dense drift
#

on 1.13 Sound implements Keyed and I can use that, but on older versions there's no such thing

sharp cove
#

😂

#

I have a option that people can vote on maps for a game. The user of the plugin van decide himself how many maps there are in the plugin. And i want to get the map with the highest vote.. how can i do this?

You can access the votes by: OorlogSimulatie.instance.kgetWorldManager.getWorld(world).getVotes();

#

Please @ me if you have an idea

dense drift
#

@lyric gyro I got it working, had to use CraftSound

val craftSound = ServerVersion.getCraftClass("CraftSound")
val field = craftSound.getDeclaredField("minecraftKey")
field.isAccessible = true

return craftSound.enumConstants.map { field.get(it) as String }```
lyric gyro
#

yeeee

dense drift
#

Hmm, wonder if is enough to catch ReflectiveOperationException 🤔

#

@pulsar ferry thoughts?

rigid mountain
#

How can i make my block break event override Factions UUID? I tried load first and event priority highest

leaden sinew
rigid mountain
#

What im trying to do is allow break of a specific block inside warzone

#

I depended on Factions but it still says i cant break

drowsy edge
#

Hi um so i have this weird thing to where when the entity takes damage, instead of replacing its name it just adds on to it...

heres code

double damage = event.getFinalDamage(), health = entity.getHealth() + entity.getAbsorptionAmount();

if (health > damage) {
                         // If the entity survived the hit
                         health -= damage;
                         entity.setCustomName(color(entity.getName() + " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"));
                     }
rigid mountain
#

Whats your question?

drowsy edge
#

like

#

whenever i punch a zombie

#

it just adds a #/# health thing

#

every time it takes damage

#

instead of replacing

#

the entire name

rigid mountain
#

ok, one thing it may be is you dont have to cast int since it is a string anyways

drowsy edge
#

nope that made it worse now its showing massive decimals

#

lol

proud pebble
#

perhaps setCustomName is bugged

drowsy edge
proud pebble
#

what server jar are you using for your test build?

#

not for the build but the test server

dusky harness
drowsy edge
#

for health

dusky harness
#

what about entity.getName()?

drowsy edge
#

thats so i can put stuff like

#

Zombie

proud pebble
#

couldnt you just do setCustomName(ChatColor.translateAlternateColorCodes('&',entity.getName() + " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"))

drowsy edge
#

or Wither Skeleton

drowsy edge
#

but the colors work anyways

proud pebble
#

what does your entity's name look like when you hit it a few times

#

exactly what it looks like

proud pebble
#

put it in text, not just a description

drowsy edge
#

"Zombie 19/20 18/20"

#

thats when i hit it 2 times

proud pebble
#

try using setCustomName(ChatColor.translateAlternateColorCodes('&',entity.getName() + " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"))

dusky harness
#

ic

proud pebble
#

thats just weird tbh

drowsy edge
#

idk if this causes it but

#

When i downloaded 1.18 for spigot developing

#

on there

#

bc i dont use maven yet

#

but anyways

proud pebble
drowsy edge
#

it doesnt even allow me to import JavaPlugin

#

so it doesnt work

#

im gonna remove it and retry and see if that works

#

but its super weird

drowsy edge
proud pebble
#

set your blockbreakevent's priority to highest and then check if your in warzone, if so e.setcancelled=true

#

before you setcancelled to true check if e.getblock.gettype is equal to that block type you want

rigid mountain
#

Ik they are in warzone bc im in warzone. But i have it set to highest and ignore canclled. and it works find when op, it sounds the boolean, but if im not op it doesnt even run the event

proud pebble
drowsy edge
rigid mountain
#

and it souts true if im opped

proud pebble
#

whats your breakblock listener like?

rigid mountain
#

wym

proud pebble
#

the code

#

whats it like

drowsy edge
proud pebble
drowsy edge
#

like instead of running buildtools latest mabye 1.18.1?

#

and then it actually works or smth

rigid mountain
#

I check if the block is null, or if the type isnt Sugarcane and if so return, then i get the item in hand and get its nbt and if it has a specific nbt tag i run that code there

proud pebble
#

do you check it all in 1 if statement or multiple?

rigid mountain
#

1

#

if(p == null || hoe == null || !e.getBlock().getType().equals(Material.SUGAR_CANE_BLOCK)) return;

proud pebble
#

try doing it in multiple and putting debug pmessages

rigid mountain
#

ok

#

well, ik the event isnt even running bc i have a debug sout at the top and its not sent

proud pebble
#

oh

#

what Faction plugin you building against?

rigid mountain
#

UUID

#

im assuming its something in their override

proud pebble
#

try setting e.setcancelled to false

#

@rigid mountain

rigid mountain
#

ok

#

where at?

proud pebble
#

in your event listener

rigid mountain
#

i call it when i check if the player is in warzone

proud pebble
#

your blockbreakevent specifically

rigid mountain
#

but it doesnt make it that far

#

i have it setup like this, and 1 doesnt even sout if im not op

proud pebble
#

p.sendmessage("1")

#

according to factionsuuid they use that listener

rigid mountain
#

ok, ill take a look. p.sendmessasge didnt do anything

proud pebble
#

your onbreak in your plugin doesnt do anything?

rigid mountain
#

not unless im op

#

it is registered bc it works if im op

#

or outside of warzone

#

actually i cant break blocks anywhere when im deopped

proud pebble
#

huh

#

that sounds like a very uhh not cash money sort of thing

rigid mountain
#

Yeah

#

idk why it causes that lmao

proud pebble
#

are you using any other plugin other then factions?

rigid mountain
#

I have multiple plugins, but none that should do that. I may go through and disable them all and see

proud pebble
#

yeah sounds like another plugin is doing the same thing as yours for whatever reason

formal locust
#

im making a thepit addon

night ice
#

ThePitAddon.java Show this class

night ice
#

do this after onEnable()
ThePitAPI thepit = Bukkit.getServicesManager().getRegistration(ThePitAPI .class).getProvider();

formal locust
#

new error

night ice
#

what is in line 18?

formal locust
#

ThePitAPI thepit = Bukkit.getServicesManager().getRegistration(ThePitAPI .class).getProvider();

night ice
#

is the plugin PitAPI enabled?

formal locust
#

yes

#

its in onEnable

#

@night ice ?

#

Main thepit = Bukkit.getServicesManager().getRegistration(Main .class).getProvider();
ThePitAPI api = Bukkit.getServicesManager().getRegistration(ThePitAPI .class).getProvider();
Bukkit.getPluginManager().registerEvents(new PlayerKillEvent(this), this);
new StatsCommand(this);

night ice
#

check whether the pit plugin is enabled before loading its class and also if not added, add it as depend or soft dependent on plugin.yml...

The most obvious reason for that not work is that your plugin is loading before the other plugin

formal locust
#

the addon is loading after plugin

night ice
#

Then ask to the owner of the plugin maybe

formal locust
#

k

ocean raptor
#

how can i check if the TextComponent's content is same with another TextComponent

night ice
#

Its an object right, you can check #equals() IG

lyric gyro
#

.plsnolombok

#

.lombok

cinder forum
#

pinned msg

neat pierBOT
#
FAQ Answer:

Why is Lombok bad?

  • It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
  • It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
  • Lombok'd code won't show in Javadocs
  • The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
  • Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
  • While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
  • Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
wraith scarab
#

Hi


String ItemDura = "e";

                    if(i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
                        ItemName = i.getItemMeta().getDisplayName();
                        if(i.getItemMeta() instanceof Damageable) {
                            Damageable ItemDamageable = (Damageable) i.getItemMeta();
                            ItemDura = String.valueOf(ItemDamageable.getDamage());
                        }
                    }


When i try ItemDura still be "e" and on't change i try wit ha goldensword with 28 durabilty a ston sword with all durablity and with gunpowder

spiral prairie
#

what

wraith scarab
#

i am trying to get the durabilyti of a item

#

but i can't

broken elbow
#

well then most likely, the item does not have a display name

wraith scarab
#

xd

#

thx

#

i'm so dumb

stuck rain
#

Spellcheck be like: 😴

ocean raptor
#

useless

spiral prairie
#

ohh

#

i thought we talking ab strings lol

shell moon
#

is it bad to shade mysql connector in my plugin? (so it works when using spigot 1.8 in mysql 8.x?

spiral prairie
#

no

#

but make sure to relocate it

shell moon
pulsar ferry
#

Try Adventure, it's actually good unlike that one fingerguns

dense drift
#

this$text

pulsar ferry
#

Decompiled

dense drift
#

if you say so

lyric gyro
#

Isn't that lombok generated?

dense drift
#

Why..

lyric gyro
#

because md5

ocean raptor
#

didnt check the github, i pressed middle button to see equals method and i saw obj == this

#

probably something went wrong while decompiling the code but im not sure

lyric gyro
#

well the interface doesn't have the equals method, the implementation does, you work with the API which are the interfaces

#

why do you need to check components for equality tho?

dense drift
#

Equality for components!!

ocean raptor
lyric gyro
#

don't do that

warm steppe
#

#equalcomponentrights

lyric gyro
#

that = checking display names for "special" items

#

use PDC

ocean raptor
#

ah

lyric gyro
#

components (display names, lore, etc) is for the client to render and see

#

it always was

#

even when it was a string

#

but very badly misused

ocean raptor
#

yeah good idea. didnt think of that, thank you

pulsar ferry
lyric gyro
#

it's still not something one should use for any particular reason ccatrainbowshrug

pulsar ferry
#

Yeah

broken elbow
#

Hmm. I've got this option in my settings.yml (yes yml 😦 )

option: "<yellow>----<red><hover:show_text:\"<gold>Click!\"><click:run_command:/help %prev%><< Previous</click></hover> | <hover:show_text:\"<gold>Click!\"><click:run_command:/help %next%>Next >></click></hover><yellow>----"

but it looks like this when I use the default minimessage parser. It has something to do with the << from << Previous? Can I maybe escape those things somehow? \<\< doesn't work.

#

ok. now I get this

#

the thing is the same thing <yellow>----<red><hover:show_text:"<gold>Click!"><click:run_command:/help %prev%><< Previous</click></hover> | <hover:show_text:"<gold>Click!"><click:run_command:/help %next%>Next >></click></hover><yellow>---- works on adventure's online parser https://webui.adventure.kyori.net/

leaden sinew
#

I saw that

broken elbow
#

dkim stop deleting your messages. smh xD

dusky harness
#

🙂

broken elbow
#

just multiply by 1000 or was it 10000?

#

something like that

leaden sinew
#

20

dusky harness
#

1000

#

just got confused since ESX says ticks instead

broken elbow
leaden sinew
#

Lol I don’t know

#

I just know 20 ticks = 1 second

dusky harness
#

I was expecting this to be 07:41 🥴

#

but then i realized it
and deleted my message

broken elbow
#

ok

dusky harness
#

yes

broken elbow
#

now pls help me. lol

dusky harness
#

?help

neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

broken elbow
#

send help

dusky harness
#

😃

broken elbow
#

I want to die

dusky harness
#

☹️

broken elbow
dusky harness
#

I apologize

broken elbow
#

man I'm to tired for this shit

#

good night

dense drift
#

@broken elbow just use the double arrow symbol

broken elbow
#

but... 😦

#

that doesn't fix the bug. if it is a bug.

dense drift
#

Or \\<

broken elbow
#

I'll just join kyori discord tomorrow if they do have one and see if its actually a bug

broken elbow
#

its like the escape wasn't there at all

#

good night

dense drift
#

Gn

dusky harness
#

gn

lyric gyro
#

By a thousand miles

leaden sinew
sharp cove
#

What is in Java the difference between System.out.println() and System.out.print()?

wheat carbon
#

println appends a new line to the end of the message

#

print doesn't

sharp cove
#

ah

#

thankyu

mellow kindle
#

hey

#

does anyone know how to set priority to tabs

#

like some players get moved up in the tabs plugin

sharp cove
#

Like 1 or what ever

broken elbow
#

well... after I get configurate to work lol. switched to it and its not going very well

broken elbow
random harbor
#

Hello, I'm making a custom scoreboard plugin with PlaceholderAPI's placeholders. I cant seem to color any of the placeholders?

    public void createBoard(Player p){
        String configLineOne = PlaceholderAPI.setPlaceholders(p, getConfig().getString("LineOne"));


        ScoreboardManager manager = Bukkit.getScoreboardManager();
        org.bukkit.scoreboard.Scoreboard scoreboard = manager.getNewScoreboard();
        Objective objective = scoreboard.registerNewObjective("MainBoard", "dummy", ColorUtils.translateColorCodes(configTitle));

        objective.setDisplaySlot(DisplaySlot.SIDEBAR);

        Score s6 = objective.getScore(ColorUtils.translateColorCodes(configLineOne));

        s6.setScore(5);


        p.setScoreboard(scoreboard);
    }

Config
#PlaceholderAPI Supported
#HexColor Codes Supported usage: &#(hexNumbers)
LineOne: "&#4287f5Association #92eb34%mmocore_class%"

&#4287f5 Works
#92eb34 Has no effect
broken elbow
#

what is your translateColorCodes method?

random harbor
#

Regular color codes have no effect either.

#
    public static String translateColorCodes(String text){

        String[] texts = text.split(String.format(WITH_DELIMITER, "&"));

        StringBuilder finalText = new StringBuilder();

        for (int i = 0; i < texts.length; i++){
            if (texts[i].equalsIgnoreCase("&")){
                //get the next string
                i++;
                if (texts[i].charAt(0) == '#'){
                    finalText.append(net.md_5.bungee.api.ChatColor.of(texts[i].substring(0, 7)) + texts[i].substring(7));
                }else{
                    finalText.append(ChatColor.translateAlternateColorCodes('&', "&" + texts[i]));
                }
            }else{
                finalText.append(texts[i]);
            }
        }

        return finalText.toString();
    }
surreal lynx
#

Does anyone know what's wrong with our economy plugin? When trying to purchase an item while using https://www.spigotmc.org/resources/1-14-1-18-shopkeepers-addon-navigation-economy-plotsquared-vault-integration.98400/, for some reason it adds money instead of taking money. We get some other issues when attempting to use essentials eco commands, but I don't have a demonstration of that right now

Vault implementation and database handler:
https://paste.gg/p/anonymous/5ad56582e485443694c39b8be2ee65ea

#

(ping please)

dense drift
#

The logic for remove() is weird ngl

#

uuid = uuid and balance >= toRemove why do you need the balance check? Or is it not your plugin

spiral prairie
#

Am i the only dumb guy here or why am not finding this

dense drift
#

Because it uses a library

#

EconomyTable.uuid eq uuid ...

spiral prairie
#

jetbrains exposed

dense drift
#

Ye

spiral prairie
#

yeah

#

also, balance check is for negative eco

dense drift
#

Well, then the cache will have a different value that the database

spiral prairie
#

will it?

dense drift
#

Because the cache gets updated even if the balance is not greater than toRemove

spiral prairie
dense drift
#
val player = DatabasePlayer(

uuid,

if (cache.containsKey(uuid)) cache[uuid]!!.bankBalance - toRemove else 0,

System.currentTimeMillis()

)

cache[uuid] = player```
#

I'm on mobile so the format is probably weird

spiral prairie
#

does anything else seem cringe

dense drift
#

@surreal lynx can you send CachedBankAPI.removeFromBankBalance?

dense drift
#

Optional.of(Constant...add(player, balance))

#

That doesnt look right @surreal lynx 3rd line from bottom to top

spiral prairie
#

yes it doesnt

#

happens when someones uses CTRL+C and CTRL+V too much

dense drift
#

Indeed

surreal lynx
#

Thanks for the help hmc_heart

broken elbow
#

what would be the regex to be able to have 0 or more spaces?
[ ]+? is not it since it requires 1 ore more.

#

oh its * instead of +

dense drift
#

\s*

lyric gyro
#

you can get rid of the brackets and the ?

broken elbow
#

ah right. thanks

river solstice
#

Is there a reliable way to slow down world time?

mental cypress
#

Thread.sleep 👌

river solstice
#

TRUE

broken elbow
river solstice
#

like if I have a repeating task

#

that would set back the time by x ticks

#

would that be dumb?

#

I imagine the sun movement would be kind of jerky

lyric gyro
#

i remember there was a plugin that had a feature like that

broken elbow
#

a feature that had a feature that had another feature that also had a feature

spiral prairie
#

what

#

a feature that had a feature that had another feature that also had a feature

lyric gyro
#

I think it uh changed the doDaylightCycle gamerule constantly lol

spiral prairie
#

lol

broken elbow
#

if I have a regex patter, is there to check if a string has parts that don't match the regex? the regex is 2 groups basically. this is a good example ([0-9]+)|([a-zA-Z]+). If I try it on the text ABC(23) is there a way to see if there is parts of the string that don't match any of the groups? in this case it would be the ()'s but it could be anything else really. don't need to match them just to need to know if they exist or not

dense drift
#

matches() checks if the string is 1:1 with the regex, if that's what you mean

#

while find() checks if the regex matches any part of the string

broken elbow
#

ok. now. I want to match numbers. but also negative numbers.
so
this should not work 32 but
32
-32
and - 32 should work. how would I go about doing this?
I was thinking (\-\s*\d+) but this would take 32 as a valid answer.

dense drift
#

((-\s*)?\d+) - the minus and space are optional ? and there can be between 0 and n spaces *

#

-1 - 1 - 1 1

broken elbow
#

oh IC. I can have groups inside groups. didn't realise that.

#

thank you

dense drift
#

np

drowsy edge
#
private final String configlore;

this.configlore = section.getString("lore");

//The itemstack
List<String> lore = new ArrayList<>();

if(configlore != null) {
            lore.add(ChatColor.translateAlternateColorCodes('&', configlore));
        }

itemMeta.setLore(lore);

I honestly dont know what went wrong...

spark skiff
#

Move setLore to the if statement

drowsy edge
warm steppe
#

check if item meta is not null

#

a yeah

spark skiff
#

Yea

#

configLore != null && itemMeta != null

drowsy edge
#

it worked thanks

spark skiff
#

Np

proud pebble
#

for some reason Block.getDrops() no longer seems to include the contence of containers such as chests

#

then again im not even sure if it originally did or if its just cause my event would break

dusky harness
proud pebble
#

im not sure if it did work before

proud pebble
#

i figured it out

proud pebble
#
if (block.getState() instanceof Container) {
            Container container = (Container) block.getState();
            if (container instanceof Chest) {
                for (ItemStack item : ((Chest) container).getBlockInventory().getContents()) {
                    if (item != null) {
                        item = em.updateItemWithEnchantLore(item);
                        drops.add(item);
                    }
                }
            } else if (!(container instanceof ShulkerBox)){
                for (ItemStack item : container.getInventory().getContents()) {
                    if (item != null) {
                        item = em.updateItemWithEnchantLore(item);
                        drops.add(item);
                    }
                }
            }
        }
```it works ig
lyric gyro
#

no it doesn't peepoSMILEEEEEEEE

proud pebble
#

it doesnt

#

now it should

echo igloo
#
    public static String color(String text){
        ChatColor.translateAlternateColorCodes('&', text);
        return text;
    }

how can I make it so when I'm doing Colors.color(text) it'll work?

lyric gyro
#

Strings are immutable/unmodifiable
ChatColor.translateAlternateColorCodes returns the "colorized" string, so you want to return that instead

echo igloo
#

what?

lyric gyro
#

what what?

echo igloo
#

how do I return it?

lyric gyro
#

return ChatColor...

echo igloo
#
    public static String color(String text){
        ChatColor.translateAlternateColorCodes('&', text);
        return ChatColor.translateAlternateColorCodes('&', text);
    }
#

like this?

lyric gyro
#

you can omit the first call, you're not doing anything with it since you're ignoring the returned value

echo igloo
#
    public static String color(String text){
        return ChatColor.translateAlternateColorCodes('&', text);
    }
#

like this right?

lyric gyro
#

yep!

echo igloo
#

thanks 🙂

lyric gyro
#

yw

icy grail
#

You have to use some sort of spatial partitioning

#

And you will also want to make sure that you don't have each claim registering its own personal listeners, because that will get very slow with lots of claims

#

Best to make sure that every claim is in a map, and when an event is fired, you determine what claim it's in and then figure out what to do about it

icy grail
#

Ok you want to get nearby cuboids to another cuboid

#

Spatial partitioning is probably the best way

icy grail
#

Pretty nuch

#

It maps approximate locations to objects

mint holly
#

How to get player name by uuid?

ocean raptor
#

anyway, Bukkit.getOfflinePlayer(UUID).getName()

mint holly
#

Thank you.

ocean raptor
#

there is another efficient way to get player's name if your server is offline moded

ocean raptor
dense drift
#

That method returns an OfflinePlayer regardless the type of the server, premium or not

ocean raptor
#

yeah

dense drift
#

Glad you agree with mee

ocean raptor
formal crane
#

Anybody here that knows how to fix this?

Your build is currently configured to use Java 17.0.1 and Gradle 7.1.1.

Possib
 - Use Java 16 as Gradle JVM: Open Gradle settings 
 - Open Gradle wrapper settings, change `distributionUrl` property to use compatible Gradle version and reload the projectle solution:```
sterile hinge
#

no, update gradle to 7.3.x

fair sage
#

I'm an operator on my server, and I'm using permissions checking in my plugin. For some reason, even though I'm an operator it still doesn't think I have the permission node. Anyone know the issue?

#

I'm using 1.18.1

warm steppe
#

make a owner group with only permission *

dusty frost
#

Would be very convenient

spark totem
#

I feel offended by that xd, since i suck at these things

lyric gyro
#

at reading?

broken elbow
#

yes

#

got anything against that?

drowsy edge
#

https://paste.helpch.at/agetufunak.cpp

I honestly dont know why this is happening,

Whever i summon a boss whenever I hit it the boss' name goes from "Doge the Great 500/500" to "Doge the Great 500/500 499/500", And a regular mob has no custom name when I hit it

leaden sinew
#

#bot-commands message
getCustomName is nullable

drowsy edge
#

ah

#

it is null

worn jasper
#

uh trying to use papi api and I am kinda confused, what's the difference between With a Plugin (Internal Class) and With a Plugin (External Jar)?

#

let me rephrase that, when should I use which?

dense drift
#

Internal class means you have a class inside your plugin that extends PlaceholderExpansion, and external jar means the expansion is in its own jar and (optional) can be published to the ecloud

worn jasper
#

oh ok thx

#

I am kinda unsure why it's happening, I mean, I do see it's a nullpointer

#

but ye

#

Yup, just rechecked and everything is looking the same

dusky harness
#

and see if it works

worn jasper
#

ye lol

#

but the guide said it required that

worn jasper
#

unless I forgot something..

#

do I need to register it or smt

dusky harness
#

im guessing getRequiredPlugin is null

#

which is causingthe error

worn jasper
#

wdym

dusky harness
#

try removing that method

#

it's not needed for your case

worn jasper
#

I already removed what you said

#

or wait

#

ye

#

I did

#

no errors

dusky harness
#

is there an error?

worn jasper
#

but 0 placeholders are registered

#

okay well

dusky harness
#

ye its active

#

what if you do /papi parse me %adisplay_armor%

worn jasper
#

doesn't do anything

#

like, it only shows %adisplay_armor%

dusky harness
#

🤔

broken elbow
#

ah found it.

worn jasper
#

ye

broken elbow
#

ok. so removing canRegister will register the expansion but the placeholder doesn't work you're saying?

#

well my first guess would be that return plugin.getListArmor(p); returns null.

#

try returning a random string "test" for example

#

in that if block

worn jasper
#

ok

broken elbow
#

oh wait

#

one major problem

#

lol

worn jasper
#

lol

#

tell me

broken elbow
#

you're not overriding the actual onRequest method

#

this is yours

#

this is what you should have

worn jasper
#

oh fk

broken elbow
#

it takes in an offline palyer. and you need to annotate it with override

worn jasper
#

ye testing rn

trail burrow
broken elbow
#

mind showing the code?

#

specifically the LastLoginAPIHook class

trail burrow
#

do you need more?

lyric gyro
#

i need a hug

trail burrow
#

all I can give is a virtual hug

broken elbow
#

I'm a bit confused, why not use the offered method to get the instance of llapi?

trail burrow
#

pretty sure this line is my issuethis.lastLonginAPI = (LastLoginAPI)plugin;

broken elbow
#

they have a LastLogin.getApi(); method

trail burrow
#

trying to make it work within the plugin I have forked

broken elbow
#

which returns an instance of LastLoginAPI

broken elbow
trail burrow
#

I used this line,LastLoginAPI api = LastLogin.getApi(); but most likely in wrong spot

trail burrow
#

I figured it out, thanks for the help

night ice
#

Hey i have a doubt Location#equals(Location lo) considers yaw and pitch?

molten wagon
#

When I get inventory with event.getSource(),event.getDestination() and so on. it only log the first item as one on hoppermoveevent. is it way around this?

#

I look on this more and you have to delay the task one tick.

brisk ice
molten wagon
wild wigeon
#

[INFO]
[INFO] ----------------< nl.gamerjoep.bankoverval:BankOverval >----------------
[INFO] Building BankOverval 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sk89q.spigot:bukkit-classloader-check:jar:1.8-R0.1-SNAPSHOT is missing, no dependency information available

How to fix?

cobalt sun
#

Dont use a class thats not included in spigot

#

com.sk89q.spigot isnt included

night ice
cobalt sun
#

You can see if spigot itself has a similar function

#

Or find out which plugin adds that and add it as a dependency

wild wigeon
#

@cobalt sun

neat pierBOT
#
📋 Your paste: Rickjuhh
https://paste.helpch.at/ugoluvufeq

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

wild wigeon
cobalt sun
#

Add worldguard as a dependency in your plugin.yml

#

That might fix the original issue

#

I have no clue about the other error

cobalt sun
wild wigeon
drowsy edge
#
 entity.setCustomName(" ");
 entity.setCustomName(entity.getName());
entity.setCustomName(ChatColor.translateAlternateColorCodes('&', " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"));

Hi so I have a weird bug or issue where when i hit an entity, their name does not pop up but the health does, but if I have the code like this

entity.setCustomName(ChatColor.translateAlternateColorCodes('&', entity.getName() + " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"));

It adds the health part to it like "Zombie 20/20 19/20" which i dont want

#

there is no error.

wooden loom
#

what do you want?

drowsy edge
#

whenever I hit the mob I want it to show (in this example a zombie) Zombie 19/20

#

or with a custom named mob Knight 17/20

high edge
#

well yea you use entity#getName, which will keep appending everything together

quaint oriole
#

Hello, I'm not here to look for code nor to be spoonfed, but I would like to make an undo command for my paper/bukkit/spigot plugin.

So, what would be the best way to store the previous states of known areas. Should I like save it to a schematic file or something else?

Thanks.

queen plank
#

How do I make a plugin run on 1.16 and 1.18? Since 1.18 require Java 17

#

Or can you run 1.16 plugins in Java 17?

inner jolt
#

you should be able to run 1.16 plugins in java 17

#

is it not working for you?

queen plank
#

Oh you can? I just can't make it work

#

Noop

#

Gotta find out why

#

Cuz obv it can

#

Tnx

inner jolt
#

oh wait i'm wrong

queen plank
#

Wat

inner jolt
#

are you compiling it into java 17?

queen plank
#

Ya

#

Or what

#

The plugin?

inner jolt
#

are you the developer of the plugin?

queen plank
#

Indeed

#

I wanna make it 1.16+

inner jolt
#

you might be compiling the plugin into the wrong version

queen plank
#

What do you mean? Wrong java?

inner jolt
#

yeah

#

wrong java version

queen plank
#

What should I compile it with, for 1.18?

#

It works fine on 1.18 servers with Java 17?

drowsy edge
#

1.16 = java 15, 1.17 = java 16 and 1.18 = java 17

#

I belive

hushed badge
#

1.16 supports java 16

pulsar ferry
#

1.16 was paper Java 11, anything else was 8

#

But you can run it on 16 just fine

hushed badge
#

yeah thats what i mean

queen plank
#

How do I make it run on both 1.16 and 1.18 if they can run the same Java version then?

#

Do I make one 1.17+ copy and one 1.16 copy?

leaden sinew
#

Compile both in Java 17

#

Then you can run the server in Java 17

queen plank
#

Do I need two versions then?

#

Of the plugin I mean

#

Or can I just make one 1.18 copy, and make it run on a 1.16 server somehow?

#

If so, how?

wraith scarab
#

Hi, Here my mistake

    public String GetRarity(ItemStack itm) {
        net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itm);
        NBTTagCompound Tag = item.getOrCreateTag();
        String Rarity = Tag.getString("Rarity");
        System.out.println(Rarity); ////1
        return Rarity;
    }
    
    public ItemStack SetRarityNbtTag(ItemStack itm, String Rarity) {
        net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itm);
        NBTTagCompound Tag = item.getOrCreateTag();
        Tag.setString("Rarity", Rarity);
        System.out.println(Tag.getString("Rarity")); ////2
        item.setTag(Tag);
        return CraftItemStack.asBukkitCopy(item);
    } 

                        setRarity(ItemLore, item, RarityLore);
            item = SetRarityNbtTag(item, RarityLore); 

the outpout in the console are
[STDOUT] ////1
[STDOUT] [Common] ////2
i don't know why can anyone help me ?

#

(i try with the same item)

marble nimbus
#

Heyo, I am generating JWT Tokens for a Webservice I am working on, it works fine and during runtime I can reload the Page Infinitly and it works fine, but once I restart the Plugin all Tokens are suddenly Invalid. Here is the code for generating and decoding : https://paste.sentinalcoding.eu/MA4NyGA8Lk

wooden loom
#

is it possible to add a drunk effect to a player?

broken elbow
#

you mean nausea?

drowsy edge
#

https://paste.helpch.at/yomowejufe.cs

I fixed the first part for the normal entities but now for the boss it does the other thing for non-custom entities. I tried with a event.setCanceled() but it did not work.

honest spoke
#

Anyone worked with CORS and Ktor? My root domain is trying to send a request to the api subdomain, which gets blocked with the error (from firefox) The Same Origin Policy disallows reading the remote resource: CORS preflight did not succeed. If I look at the preflight request, it seems to have sent an options request as it should, the api subdomain has responded with the correct Access-Control-Allow-Methods header set, but with a code 500 internal server error too? Ktor logs show an unhandled OPTIONS request. Maybe I'm blind but the ktor docs don't seem to mention this, any ideas?

pulsar ferry
#

Do you have the CORS feature installed?

honest spoke
#

Yeah, I think this is the correct configuration

pulsar ferry
#

Yeah that looks fine, i am not sure then

honest spoke
#

Damn

lyric gyro
#

For some reason it won't let me build it when I use Craftarmorstand

patent zephyr
#

Hi, is there any way, how to check, if player has open inventory with Player object?

#

I cant find anything like that

patent zephyr
#

your about me

spiral prairie
#

dayum

#

this is going too far

spiral prairie
patent zephyr
#

yes

#

thank you bro

drowsy edge
spiral prairie
drowsy edge
#

lol

#

but anyways

#
 if(health > damage) {
            health -= damage;
            if (entity.getCustomName().contains("&6Doge the Great")) {
                entity.setCustomName(" ");
                entity.setCustomName(ChatColor.translateAlternateColorCodes('&', "&6Doge the Great" + " &r&c" + (int) entity.getHealth() + "/" + (int) entity.getMaxHealth() + "❤"));
                return;

            }

                entity.setCustomName(" ");
                entity.setCustomName(ChatColor.translateAlternateColorCodes('&', "&6" + entity.getType().name().toLowerCase() + " &r&c" + (int) health + "/" + (int) entity.getMaxHealth() + "❤"));
            }
        }

I feel like ive done something stupid here... the doge boss thingy wont register instead it does the other code meant for vanilla mobs

spiral prairie
drowsy edge
#

i used a translatealternatecolorcodes there too

spiral prairie
#

thats the thing

#

translate alternate color codes changes it

#

to §

#

and youre checking for &6

drowsy edge
#

oh wait

#

oh I see

spiral prairie
drowsy edge
#

yeah

#

my brain went poof

#

that worked thanks

spiral prairie
#

👍

drowsy edge
#

btw

#

i have another issue :/

#
@EventHandler
        public void bossDeath(EntityDeathEvent event) {
            if(event.getEntity().getCustomName().equals("§6Doge the Great")) {
                LivingEntity entity = event.getEntity();
                entity.getLocation().getBlock().setType(Material.CHEST);
            }
        }

wont set block, im pretty sure this works

#

btw i added this part ```java
if (event.getEntity().getCustomName() != null) {

lyric gyro
#

Try using:

entity.getLocation().getBlock().setType(new ItemStack(Material.CHEST));
#

@drowsy edge

#

i dont play around with block like that, it might just be for invs

#

not sure

drowsy edge
earnest bobcat
#

i dont think that will work

#

because that will think that the block is a item and it cant set a block to a item

lyric gyro
#

try and set it with getBlock().setTypeId()?

earnest bobcat
#

you could try to change

@EventHandler
        public void bossDeath(EntityDeathEvent event) {
            if(event.getEntity().getCustomName().equals("§6Doge the Great")) {
                LivingEntity entity = event.getEntity();
                entity.getLocation().getBlock().setType(Material.CHEST);
            }
        }

to:

@EventHandler
        public void bossDeath(EntityDeathEvent event) {
            if(event.getEntity().getCustomName().equals("Doge the Great")) {
                LivingEntity entity = event.getEntity();
                entity.getLocation().getBlock().setType(Material.CHEST);
            }
        }
lyric gyro
#

if there's a color, im pretty sure u have to include it

earnest bobcat
#

yeah

#

wait can you send me the entire source code? then i can try some different things that i may come up with

drowsy edge
#

the entire class?

earnest bobcat
#

just send the entire src folder

spiral prairie
drowsy edge
#

are you looking for any special classes??? why do you need that im confused

lyric gyro
#

have you tried to log to chat/console when the boss dies to see if it actually gets to the logic in the if statement?

spiral prairie
#

the reason it doesnt set it is probably because it died already

#

and it doesnt have a real location

drowsy edge
drowsy edge
spiral prairie
#

you could try adding the position in a move event

drowsy edge
#

I have a damage event mabye I can log It in that

#

that might work better

spiral prairie
#

hm well see

drowsy edge
#

i created this
private Location locate;
Then put the loc in the event

Location location = event.getLocation();
location = locate;

Then in death event

Block block = locate.getBlock();
earnest bobcat
#

btw i have just tested if you kill a entity and try to get his location using event.getEntity().getLocation() you actually get the location that entity died at

drowsy edge
#

so its the block setting method

#

then

#
Block block = loc.getBlock();
block.setType(Material.CHEST);
#

loc is my location thing

earnest bobcat
#

i found the problem i think

drowsy edge
earnest bobcat
#

try changing

@EventHandler
        public void bossDeath(EntityDeathEvent event) {
            if(event.getEntity().getCustomName().equals("§6Doge the Great")) {
                LivingEntity entity = event.getEntity();
                entity.getLocation().getBlock().setType(Material.CHEST);
            }
        }

to:

@EventHandler
        public void bossDeath(EntityDeathEvent event) {
            if(event.getEntity().getCustomName().equals(ChatColor.translateAlternateColorCodes('&', "&6Doge the Great")) {
                LivingEntity entity = event.getEntity();
                entity.getLocation().getBlock().setType(Material.CHEST);
            }
        }
drowsy edge
#

i dont think that will change anything but ill try

spiral prairie
#

Ohh

#

The issue is

#

You use equals

earnest bobcat
#

because first you only did that for entities named exactly §6Doge the Great

spiral prairie
#

And not contains

drowsy edge
#

oh wait

spiral prairie
#

Just do #contains("Doge the Great")

drowsy edge
#

i forgot about the whole other health thing

#

this is why i have small brain

spiral prairie
drowsy edge
#

it worked

#

im so dumb

#

now to go tourture myself for 5 hours to change meta

#

and make a custom name

spiral prairie
drowsy edge
#

do you think i can just make a chest item and then place that instead

#

bc applying meta to an item is easier than block

earnest bobcat
#

this should work: ```java
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), ItemStack);

just replace ItemStack to the predefined itemstack
drowsy edge
#

i decided on block state instead

earnest bobcat
#

ok

drowsy edge
#

and just giving the block a custom name then checking

proud pebble
#

PlayerInteractEvent is firing twice when you pass it through from the listener to a seperate class.
Its firing the same hand, not different hands and i dont know why.

#

if you dont pass through the event to another class then it works as intended

earnest bobcat
#

hello i am trying to create custom enchants the hard way becaus i like torturing myself 🙂 currently when i apply the enchant twice it also gets added to the lore twice while i want it to replace the previous lore line of that enchantment my current code for that entire command: https://www.toptal.com/developers/hastebin/bemicaloca.kotlin

drowsy edge
earnest bobcat
#

yeah

proud pebble
#

your better off just clearing the lore and starting over every time

earnest bobcat
#

i mean yeah but if i want also to have a normal lore i will have to add that again every time

drowsy edge
earnest bobcat
#

thats pretty much what i am doing now

drowsy edge
earnest bobcat
drowsy edge
#

mabye

#
Lore.remove(ChatColor.translateAlternateColorCodes('&', "&r&7Advanced sharpness I"))

then set the line

earnest bobcat
#

good idea

#

it works

#

actually i just realised setting the lore wasnt the problem the problem was that even though there already is that enchant on there it doesnt recognise it

drowsy edge
#
Chest chest = (Chest) block.getState();
chest.setCustomName("§cDungeon Chest");

this is in the death event
in my custom chest manager thing

Chest chest = (Chest) holder;
            if(chest.getCustomName() != null) {
                if (chest.getCustomName().equals("§cDungeon Chest")) {

This is in a InventoryOpenEvent

#

and it no work now

#

honestly i think the problem is the inventory open event but sad

earnest bobcat
#

i gtg sleep imma destroy my brain tommorow again

drowsy edge
#

ya know what im done with custom names for the day

leaden sinew
#

Does anyone know how to spawn packet armor stands with armor using ProtocolLib?
I am able to spawn the packet for the armor stand but not the armor, and when I try to get the entity it gives
an error saying the entity id is null.

proud pebble
#

when i right click on any block with a stick in my hand it fires 2 of the same hand

dense drift
#

cuz you need break;

proud pebble
dense drift
#

add it at the end of each case

proud pebble
#

i just said that

#

LEFT_CLICK_AIR, LEFT_CLICK_BLOCK, RIGHT_CLICK_AIR are all giving the correct output, RIGHT_CLICK_BLOCK runs it twice.

lyric gyro
#

Yeah because that action runs twice, one for each hand

#

d;spigot PlayerInteractEvent

uneven lanternBOT
#
public class PlayerInteractEvent
extends PlayerEvent
implements Cancellable```
PlayerInteractEvent has 4 fields, 1 all implementations, 18 methods, 1 implementations, and  1 extensions.
Description:

Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand().

This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air). For the purpose of avoiding doubt, this means that the event will only be in the cancelled state if it is fired as a result of some prediction made by the server where no subsequent code will run, rather than when the subsequent interaction activity (e.g. placing a block in an illegal position (BlockCanBuildEvent) will fail.

proud pebble
lyric gyro
proud pebble
#

it is

#

Expected
HAND
OFF_HAND

Returns
HAND
HAND

#

when right clicking a block with the stick

solid plinth
#

could someone help me with this please? i get an error saying "The type com.google.common.collect.ImmutableSet cannot be resolved. It is indirectly referenced from required .class files" because of the net.minecraft.world.entity.EntityTypes import. how do i fix this?

https://imgur.com/a/Y6rP68o

proud pebble
#

The problem was with my teleport some how effecting the 2nd hand type or causing it to duplicate the original task

#

if i delay the teleport task by 1 tick then its fine and it gives intended results

leaden sinew
#

Does anyone know how to set an entities rotation with packets, while they are a passenger?
I can do it when they are not a passenger, but after I make them a passenger they stop rotating

rigid mountain
#

Question, so im creating a enchant that has a chance to run some code, but the chance isnt actuallt working. Max level = 4 and nbt.getInt() = 4 so it should be %1 chance of it happening, but it happens more often

                if(new Random().nextInt(100) < chance) {
                    int rand = new Random().nextInt(cmdsToken.size());
                    String cmd = cmdsToken.get(rand);
                    Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd.replace("{player}", p.getName()));
                }```
torpid raft
#

but you should consider only having a single Random() and just calling nextInt() on it, instead of making a new one each time

#

creating a new Random is relatively expensive

rigid mountain
#

ok

torpid raft
#

i'm also pretty sure your rounding is not happening the way you want it to

#

as it is now, any value of nbt.getInt("tokenFinder") that is less than that of Double.valueOf(maxLevelToken)/2 will result in a chance of zero

#

and any others will be rounded to one

#

which means you really only have two probabilities instead of 4 (assuming you wanted 4)

cinder nimbus
#

does anyone know how i would get the duration and lvl of a potion?
i tried both
itemMeta.basePotionData - only gives name
&&
itemMeta.customEffect - only contains extra effects

torpid raft
rigid mountain
#

ok

torpid raft
#

i also recommend you store then sysout the results of each new Random().nextInt(___) to make sure they line up to what you want

#

with that you should easily be able to tell what's going on

rigid mountain
#

Alright thank you

cinder nimbus
torpid raft
#

correct

torpid raft
#

well

#

i suppose ThreadLocalRandom is safer overall

#

but since we aren't generating random values over multiple threads it shouldnt be relevant

pure crater
#

you cant simply load shared library from inside your jar

#

you have to copy it to an actual file then load it

#

an easier way to do this is probably JNA by the way

#

Oh nvm I see

#

does the JAR even have the shared library?

#

Wait yeah, i thought you were going to do this in an actual user env

#

hm

#

imma be honest i personally think jna is much easier to work with

#

maybe could you show some code?

#

maybe that could help

#

well JNA doesnt require you have all the dumb JNIExport functions and stuff and it doesnt require you to have the weird method names

#

and you can use the normal types in C or C++

#
public interface LibSomething extends Library {
    LibSomething INSTANCE = Native.load("libsomething", CMath.class);
    double doSomething(double value);
}
lethal plaza
#

Some ideas to build in java? 😄

#

For beginner

lyric gyro
#

For some reason, you are not importing the packet

spice ore
#

Hey for PlaceholderAPI how can I make it so that my plugin uses [plugin-name].%player%.[placeholder]

dense drift
#

Hmm?

night ice
sudden sand
#

Do someone has a good tutorial on changing mob target AI ?

wraith scarab
#

Hi, Here my mistake

    public String GetRarity(ItemStack itm) {
        net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itm);
        NBTTagCompound Tag = item.getOrCreateTag();
        String Rarity = Tag.getString("Rarity");
        System.out.println(Rarity); ////1
        return Rarity;
    }
    
    public ItemStack SetRarityNbtTag(ItemStack itm, String Rarity) {
        net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itm);
        NBTTagCompound Tag = item.getOrCreateTag();
        Tag.setString("Rarity", Rarity);
        System.out.println(Tag.getString("Rarity")); ////2
        item.setTag(Tag);
        return CraftItemStack.asBukkitCopy(item);
    } 

                        setRarity(ItemLore, item, RarityLore);
            item = SetRarityNbtTag(item, RarityLore); 

the outpout in the console are
[STDOUT] ////1
[STDOUT] [Common] ////2
i don't know why can anyone help me ?

#

I try with the same item

tight junco
#

uh first things first as a general java tip, make sure function names are lowerCamelCase and the same with variable names but also, not entirely sure what the issue

#

i assume getRarity is just not printing anything but i feel like you might be doing the setRarityNbtTag after the getRarity which in that case its because the item nbt hasnt been set yet

pulsar ferry
#

To make your life easier, if you're using a more recent version, use PDC

tight junco
#

^

#

1.14+

graceful juniper
#

Currently having trouble with ONLY redstone. I'm making an ore regen plugin for a friend but like i mentioned redstone seems to the be the only one thats not giving to the player when the block is being broken. Here is my code that adds items to the droplist when you mine a block:


        switch (block.getType()) {

            case COAL_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.COAL));

                return dropList;

            case IRON_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.IRON_INGOT));

                return dropList;

            case GOLD_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.GOLD_INGOT));

                return dropList;

            case REDSTONE_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.REDSTONE));

                return dropList;

            case LAPIS_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.INK_SACK, 1, (short) 4));

                return dropList;

            case DIAMOND_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.DIAMOND));

                return dropList;

            case EMERALD_ORE:

                for (int i = 0; i < (hand == null ? 1 : ItemUtils.fortuneAmount(hand) + 1); i++) dropList.add(new ItemStack(Material.EMERALD));

                return dropList;

            default:

                return dropList;

Everything else seems to work, even lapis, but not redstone? any ideas? (1.8.8 spigot btw, sadly)

tight junco
#

cant help but feel this code could be much more simplified

spiral prairie
#

Yeah, ig so

barren tangle
#

glowing_redstone_ore should help

#

because yk when you mine it , it glows

clever ridge
#

Is it normal, that team.setPrefix(prefixadmin) does absolutely nothing, or I really should change the server type to Paper (current: Spigot 1.18.1 (event extends JavaPlugin is unavailable))?

#

(ingame command does the same)

queen plank
#

How do I change the export folder for a maven project in eclipse?

clever ridge
#

Guess just export it. 😛

queen plank
#

Hmm?

clever ridge
#

Export the jar

queen plank
#

Yeah, I am. I use the run configuration. But I don't see an option to change the export directory, and google isn't very helpful

clever ridge
#

wat

queen plank
#

I'm gonna export it a lot of times, so I want it to end up in my server folder directly

clever ridge
#

Click on the File options

#

At up

#

At action bars (File, Edit, Source, etc)

#

Then select Export

#

Then Java > JAR file

queen plank
#

I'm exporting it with Maven tho

clever ridge
#

You basically zip everything into the JAR file

#

So a simple export must be enough

queen plank
#

Can you still export using the "regular" export method? Don't you need to export it with maven?

queen plank
#

Then why are you telling me this?

clever ridge
#

Which one?

queen plank
#

Confused

clever ridge
#

I told you how to export it

queen plank
#

Yeah

#

But not with maven

#

And as you said, I have to export with maven

clever ridge
#

I think it will export the mavem too

dusky harness
#

export button will not work for maven

#

they're separate

clever ridge
#

Oh

dusky harness
#

you have to use mvn clean package

queen plank
#

Ahh

#

Ok

dusky harness
#

eclipse has a button for it i think, but i don't use eclipse so I'm not sure

clever ridge
#

Well, the devs of Maven should have been making Maven easier then. >:c

dusky harness
#

gradle 😌

clever ridge
#

I don't understand both

#

Once

#

I tried to import PAPI into my plugin

#

and it was just a hilarious failure

dusky harness
#

👀

clever ridge
#

Both Maven and Gradle sucks in my life.

dusky harness
#

well

#

it is difficult at first

clever ridge
#

😔

#

I know

#

But like

#

why

#

D:

queen plank
#

I have this, should I export using the "Maven Clean"?

#

I'm new to Maven so idk what I'm doing really

clever ridge
#

The fun fact that the /team command does nothing too.

#

What else can I do then? c.c

graceful juniper
graceful juniper
graceful juniper
barren tangle
#

np :)

pulsar ferry
clever ridge
#

.-.

#

Uuuh

#

But I use Eclipse

#

c.c

dusky harness
#

that COMPILE TIME

#

⁉️

clever ridge
#

wat

dusky harness
#

took 632ms

#

mine is 2 sec :((

clever ridge
#

Isn't 632ms more than 2 secs?

sudden sand
#
@Override
    protected void initPathfinder() {
        this.goalSelector.a(0, new PathfinderGoalFloat(this));
        this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 15.0F));
        this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 1.0,true));

        this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, true));
    }

how can I make so even if the player is a bit far or seperated by walls the entity still try to find the nearest player ?

queen plank
dusky harness
queen plank
#

dkim

dusky harness
#

so matt's is 0.632s

dusky harness
queen plank
#

How did you say that I would change the export directory for the maven projcet?

#

I didn't understand 😦

#

And you said to use clean install?

clever ridge
#

'cause 20 ticks equals 1 second

sudden sand
#

ticks != ms

pulsar ferry
sudden sand
#

ticks aren't a static time measure like if your serv is laging then 1 sec can be equal to 23 ticks or even 18

pulsar ferry
solid plinth
sterile hinge
#

how do you use nms?

queen plank
#

Is there a good way to verify that a minecraft user has ownership of a discord account? I want to check if the discord account entered in a config file actually belongs to the minecraft user. I've seen TechsCode use it for UltraPermissions in-game updater via some discord verification link or smth.

tight junco
#

you could save accounts with a random code + database but also if its directly using discord theres an authorized apps section

sudden sand
#

Is there any javadoc for nms

queen plank
# tight junco you could save accounts with a random code + database but also if its directly u...

Maybe I should have elaborated further on what I want. When my plugin starts, I want it to check in a dc server if the discord account entered in a config file has a specific role. If the account does not, the plugin will disable itself. So I want to verify that the server owner actually owns the discord account from the cfg file, and doesn't just pretend that they do. What is the best way to do that?

night ice
torpid raft
night ice
torpid raft
#

the user makes their own bot, and gives the plugin the secret key for that

night ice
#

thats the same i mentioned

torpid raft
#

no, there would be no point for that in his plugin

#

he wants to check the status of users in his own discord, which other people should not be allowed to add a discord bot to for multiple reasons

#

and having your plugin users create their own discord bot is pointless if the bot doesnt have access to the role information you want

night ice
#

hmm..yeah mb upon reading it again, i understood that he need somekind of licensing system or so...

torpid raft
#

yeah, no worries

torpid raft
#

but this carries a few issues with it as well, namely:

  • you have to worry about people sharing secret keys
  • you (always) have to worry about people modifying your source code to remove your drm
night ice
pulsar ferry
#

Open source it and don't care about any of that fingerguns

torpid raft
#

make it super expensive and have a super strict drm but also open source it so people think they're getting a sweet deal by building and using your plugin for free 🧠

brittle thunder
#

macro

#

🥲

torpid raft
#

yugi broke

#

why does your macro import scanner

#

o.O

tight junco
#

how bad of an idea is this

warm steppe
#

it depends

#

I do something similar on onDisable() {} and it seems ok

solid plinth
leaden sinew
sterile hinge
tight junco
#

i can but eh they're kinda wack

#

and that specifically is saving a byte array and i'm not entirely sure how much String#format likes a byte array

leaden sinew
#

Why do you need to format a String?

solid plinth
tight junco
#

iirc batch only supports adding a string

solid plinth
#

Because I didn't see any other responses, sorry about that

sterile hinge
solid plinth
#

I used BuiltTools jar to get the unobfuscated version

#

The name said "original spigot something something"

#

Is there a better way?

sterile hinge
#

I only know that spigot sucks, paperweight works pretty good for me

leaden sinew
#

I’ve used it for things other than Strings

night ice
tight junco
#

no #setString or #setByteArray or anythin

night ice
#

yeah...

tight junco
#

and i dont believe String#format supports byte arrays which is my issue

leaden sinew
#

Wait that’s not how it works

tight junco
#

yeah lmao

leaden sinew
#

When you add the batch

#

It’s like executing a statement but you execute the batch after adding multiple

tight junco
#

i know how batch statements work

leaden sinew
#

There should be a method with no parameters

leaden sinew
tight junco
#

okay

leaden sinew
#

Probably not different

tight junco
#

there's not a method with no parameters for prepareStatement

leaden sinew
#

No

#

For addBatch

tight junco
#

who knows who cares

leaden sinew
#

Instead of statement.executeUpdate

#

statement.addBatch

tight junco
#

nope

leaden sinew
#

And it doesn’t work with PreparedStatement? Because it’s in the JavaDocs

tight junco
#

nope

leaden sinew
#

Are you sure

#

I checked and it’s not in Statement

#

But it’s definitely in PreparedStatement

tight junco
#

nope dont know why feelsShrugMan

leaden sinew
#

Can you show it again?

tight junco
#

wait no im dumb

#

i havent coded for over a month and my brain just gave up working PU_PeepoSMH

leaden sinew
#

Lol

#

So you got it to work?

tight junco
#

maybe

wraith scarab
night ice
vernal oar
#

hi everyone!

#

I'm making registering a placeholder which allows you to format other placeholders using java.util.Formatter

#

so you can have left/right alignment and other nice stuff

#

however, the Formatter uses parenthesis to do that, and papi removes the parenthesis and messes up the placeholder lol

#

Is there any way to "escape" the parenthesis? Sort of like this %formatter_{%-15s %n}{%sussy_balls%}%

#

I mean, I can manually accomplish this with some string magic

#

but I'm wondering if papi will allow me to just escape parenthesis bc it's really annoying and treats them all as separate placeholders

#

ugh

tight junco
#

%sussy_balls%

grim oasis
#

😂

vernal oar
#

SUS

grim oasis
#

am I crazy? this was working 2 seconds ago...
Why is ```java
Bukkit.getLogger().info(strings[1]);
Bukkit.getLogger().info(strings[1].replace("\{", ""));

outputting

{item}
{item}

tight junco
#

outplayed i guess

grim oasis
#

huh?

sterile hinge
#

replace does not take a regex

#

d; String#replace

uneven lanternBOT
#
public String replace(CharSequence target, CharSequence replacement)```
Description:

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab".

Since:

1.5

Parameters:

target - The sequence of char values to be replaced
replacement - The replacement sequence of char values

Returns:

The resulting string

grim oasis
#

i'm so confused

sterile hinge
#

replaceAll takes a regex

grim oasis
#

aha

#

I broke it at one point for some reason