#development

1 messages · Page 143 of 1

high edge
#

The icon itself won't, but just set the lore and stuff?

shell moon
#

What if someone wants that the placeholder returns something like &lHello

#

it will always return §lHello, no way to prevent this?

icy shadow
#

you could do some evil text replacement

#

eg
replace & with £:!@$J!U%!*'41
apply papi
replace £:!@$J!U%!*'41 with &

shell moon
#

xdd

icy shadow
#

so that it doesnt translate the &

shell moon
#

but then placeholder wont return &l

icy shadow
#

no, it'll return £:!@$J!U%!*'41l

#

and then you can turn that into &l

shell moon
#

wait what?

#

i dont think that helps

#

if the placeholder will be used by other plugins

icy shadow
#

ok lets go back to the start

shell moon
icy shadow
#

why do you want it to return &l and not §l?

shell moon
#

just a tho

#

my placeholder for example

#

should return not parsed color nodes

#

but ofc it makes it return parsed ones

#

(which i think it shouldn't)

#

i mean, that forces all expansions to return parsed colors

#

which makes it impossible to return a string with &l (even wanting to)

icy shadow
shell moon
#

to be used somewhere else

icy shadow
#

where else

shell moon
#

somewhere else

icy shadow
#

please can you just tell me the full context rather than making me ask such specific questions

shell moon
icy shadow
#

because as always, context is important

broken elbow
shell moon
#

there is not a full context

icy shadow
#

yes there is

shell moon
#

my placeholder simply should return not parsed ones

icy shadow
#

there must be some situation where you actually need it to be & and not §

shell moon
#

in case owners need it

icy shadow
#

but why not?

#

why would they ever need it

shell moon
#

i have normal, and not_parsed "version"

#

well, you never know, maybe a plugin requires it

#

or something

#

idk

broken elbow
icy shadow
#

honestly if you cant think of an actual reason why you need this then it sounds like a waste of time

#

like yeah it's not ideal

broken elbow
icy shadow
#

but you clearly dont have any actual problems right now

broken elbow
#

that's a good reason

shell moon
#

i mean, the fact that devs/expansions cannot return whatever they want

broken elbow
#

what if my placeholder returns a minimessage string for example that I want to contain &

shell moon
#

it's already a problem

icy shadow
broken elbow
#

they'll be replaced to section symbols and it will break them

shell moon
#

its not "why you need it"

#

it simply changes expansion output

broken elbow
#

anyways it shouldn't be PlaceholderAPI's job to translate colros. and yeah its marked as a bug afaik. no idea when they'll fix it

shell moon
#

lets say placeholder %theoptions%
returns Options: a&b
it will look only like Options: a

#

why would an expansion return something like that? god knows why

icy shadow
# shell moon its not "why you need it"

YEs it is, because if you were writing a plugin and using papi as an api then the original solution i described would've worked, but because you refused to actually give any specific information we wasted both of our time having to get to this point

shell moon
#

but changing the output is the issue here

dusky harness
#

🤔

shell moon
dusky harness
#

Oh right

#

It'd be a breaking change

shell moon
#

which would "break" already setup stuff

#

i mean, they should be using it if they want color nodes parsed ni first place

broken elbow
shell moon
#

but i guess they are simply lazy

dusky harness
#

Also off topic but mobile doesn't show the @ of you reply with ping on 🤔

#

Hm

broken elbow
#

yeah

#

its been like that for a while

#

well always

shell moon
icy shadow
#

i know that

lyric gyro
#

papi bad

shell moon
#

and if they want to return "Please select between: a&b&c"

#

they should be able to

icy shadow
#

i also know that

#

i never said otherwise

lyric gyro
#

a&[zwj]b

icy shadow
#

but making breaking changes to papi isnt exactly gonna happen, and so i suggested a workaround

dusky harness
#

Hopefully papi 3 (coming soon™️) will have this fixed

#

:)

icy shadow
#

if you had given enough information from the start, i wouldve known that this workaround wasnt applicable

#

so please

#

just be specific

lyric gyro
#

papi 2077

broken elbow
#

2069

shell moon
#

well at least it's not such breaking change like when EZPlaceholderHook was removed

icy shadow
#

someone died last time breaking changes were made so

dusky harness
#

Wait what

sly spindle
#

What's the new unregisterExpansion()? I tried to find it on github

broken elbow
broken elbow
#

unregistering null, won't really work xD. will just give you a

#

NPE

sharp hemlock
#

Hello, i wanna reproduce the riptide animation movement just using velocity depending on the level. Obviously i've cancelled the riptide and everything that works lovely. I just wanna be able to now reproduce it. But with the math, i dont know where to get started kekW

past ibex
tight tide
#

d

stuck canopy
#

help

#

import org.bukkit.Material;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;

import java.util.ArrayList;
import java.util.List;

public class Spawners {

    public static ItemStack CaveSpiderSpawner;

    public static void init() {
        createSpawner();
    }

    public static void createSpawner() {

        ItemStack caveSpider = new ItemStack(Material.SPAWNER, 1);
        BlockStateMeta meta = (BlockStateMeta) caveSpider.getItemMeta();
        meta.setDisplayName("Cave Spider Spawner");
        List<String> lore = new ArrayList<>();
        lore.add("Place this to get a Cave Spider Spawner");
        meta.setLore(lore);
        CreatureSpawner creatureSpawner = (CreatureSpawner) meta.getBlockState();
        creatureSpawner.setSpawnedType(EntityType.CAVE_SPIDER);
        meta.setBlockState(creatureSpawner);
        caveSpider.setItemMeta(meta);
        CaveSpiderSpawner = caveSpider;

    }
}
#

why is it not changing the spawner to cave spider?

dense drift
#

d;spigot BlockState#update

uneven lanternBOT
#
boolean update()```
Description:

Attempts to update the block represented by this state, setting it to the new values as defined by this state.

This has the same effect as calling update(false). That is to say, this will not modify the state of a block if it is no longer the same type as it was when this state was taken. It will return false in this eventuality.

Returns:

true if the update was successful, otherwise false

stuck canopy
#

import org.bukkit.Material;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;

import java.util.ArrayList;
import java.util.List;

public class Spawners {

    public static ItemStack CaveSpiderSpawner;

    public static void init() {
        createSpawner();
    }

    public static void createSpawner() {

        ItemStack caveSpider = new ItemStack(Material.SPAWNER, 1);
        BlockStateMeta meta = (BlockStateMeta) caveSpider.getItemMeta();
        meta.setDisplayName("Cave Spider Spawner");
        List<String> lore = new ArrayList<>();
        lore.add("Place this to get a Cave Spider Spawner");
        meta.setLore(lore);
        CreatureSpawner creatureSpawner = (CreatureSpawner) meta.getBlockState();
        creatureSpawner.setSpawnedType(EntityType.CAVE_SPIDER);
        meta.setBlockState(creatureSpawner);
        caveSpider.setItemMeta(meta);
        creatureSpawner.update(true);
        CaveSpiderSpawner = caveSpider;

    }
}
#

didnt work

wintry grove
#

I think you have to update it before setting the blockstate to the meta

shell moon
#

When using IDEA with git/github integration/plugin

#

well, idek how to ask xD

lyric gyro
#

How can i put all my warps into a GUi

#

with a for loop

#

looking for an example as ik i can do something like this public void getWarps(Player player) { StringBuilder sb = new StringBuilder(); for (String s : warpConfig.getConfig("warp", "warps").getConfigurationSection("Warps").getKeys(false)) { sb.append(s + ", "); } cmf.header(player, MessageType.INFO); player.sendMessage(cm.Colour("&aWarps: " + sb.toString())); cmf.footer(player); }

shell moon
#

whats the actual question?

#

getWarps shouldn't return a list or something? I mean, it's a get thing

#

so you can use it somewhere else i guess

gloomy geode
#
Bukkit.getScheduler().runTaskTimer(this, () -> {
            for(Player allplayers : Bukkit.getOnlinePlayers()){
                gconfig.getString("Announcement1.Announcement");
                gconfig.getInt("Announcement1.Timer");
                allplayers.sendMessage(A1);
            }
        },20*A1T,(20*A1T)+(20*A2T)+(20*A3T));

        Bukkit.getScheduler().runTaskTimer(this, () -> {
            for(Player allplayers : Bukkit.getOnlinePlayers()){
                gconfig.getString("Announcement2.Announcement");
                gconfig.getInt("Announcement2.Timer");
                allplayers.sendMessage(A2);
            }
        },(20*A1T)+(20*A2T),(20*A2T)+(20*A3T)+(20*A1T));

        Bukkit.getScheduler().runTaskTimer(this, () -> {
            for(Player allplayers : Bukkit.getOnlinePlayers()){
                gconfig.getString("Announcement3.Announcement");
                gconfig.getInt("Announcement3.Timer");
                allplayers.sendMessage(A3);
            }
        },(20*A1T)+(20*A2T)+(20*A3T),(20*A1T)+(20*A2T)+(20*A3T));
#

making an announcement plugin

#

not really understanding how i could make these go in order

#

instead of the odd delay and period times

#
        String A1 = gconfig.getString("Announcement1.Announcement");
        String A2 = gconfig.getString("Announcement2.Announcement");
        String A3 = gconfig.getString("Announcement3.Announcement");
        Integer A1T = gconfig.getInt("Announcement1.Timer");
        Integer A2T = gconfig.getInt("Announcement2.Timer");
        Integer A3T = gconfig.getInt("Announcement3.Timer");
#

I was told an array list would work but couldn't quite wrap my head around implementing that : P

shell moon
#

what?

gloomy geode
#

actually im gonna make my life easier and just make one timer option configurable for all

shell moon
hoary scarab
# gloomy geode ``` Bukkit.getScheduler().runTaskTimer(this, () -> { for(Player allp...
// Initializes map to be used for saving announcement times and messages
Map<int, List<String>> announcements = new HashMap<>();

// Lines below add times and arraylists (of strings) to map.
// announcements.put(20, Arrays.asList("This announcement runs every second."));
// announcements.put(100, Arrays.asList("This announcement runs every 5 seconds."));
// announcements.put(1200, Arrays.asList("This announcement runs every minute.", "Yes multi-line messages are possible."));

// Creating a variable to use as a counter
int count = 0;

// Creates a variable to cache our annoucnement task
BukkitTask announcementTimer;
public void startAnnouncements() {
    
    // Checks if our task is already running
    if(announcementTimer != null) return;

    // Initializes our task variable by creating a bukkit task
    announcementTimer = Bukkit.getScheduler().runTaskTimerAsynchronously(<JavaPlugin>, () -> {

        // Increments our counter
        count++;

        // Iterates (loops) through our announcement map's entries
        announcements.entrySet().forEach(a -> {

            // Variablizes our key and values
            int time = a.getKey();
            List<String> messages = a.getValue();

            // Checks if the count is dividable by the announcements saved time then broadcasts the string list to online players.
            if(count % time == 0)
                messages.forEach(msg -> Bukkit.broadcastMessage(msg)); // Add chat color and such.
        });
    },0, 1);
}
```Written on discord adjust code as necessary.
gloomy geode
#

just so I can look it up and learn what's happening here

hoary scarab
#

I just wrote it lol A simple way to broadcast on timers.

gloomy geode
hoary scarab
gloomy geode
#

really appreciative of the comments

hoary scarab
#

👍

lyric gyro
#

im getting this error

#

can someone help me

sterile hinge
#

That’s not the full exception

high edge
#

at net.evilblock.cubed.command.CommandNode.invoke(CommandNode.kt:285)

lyric gyro
#

i cant send screenshots but thats it

neat pierBOT
stuck canopy
#

import org.bukkit.Material;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;

import java.util.ArrayList;
import java.util.List;

public class Spawners {

    public static ItemStack CaveSpiderSpawner;

    public static void init() {
        createSpawner();
    }

    public static void createSpawner() {

        ItemStack caveSpider = new ItemStack(Material.SPAWNER, 1);
        BlockStateMeta meta = (BlockStateMeta) caveSpider.getItemMeta();
        meta.setDisplayName("Cave Spider Spawner");
        List<String> lore = new ArrayList<>();
        lore.add("Place this to get a Cave Spider Spawner");
        meta.setLore(lore);
        CreatureSpawner creatureSpawner = (CreatureSpawner) meta.getBlockState();
        creatureSpawner.setSpawnedType(EntityType.CAVE_SPIDER);
        creatureSpawner.update(true);
        meta.setBlockState(creatureSpawner);
        caveSpider.setItemMeta(meta);
        CaveSpiderSpawner = caveSpider;

    }
}
lyric gyro
broken elbow
sterile hinge
#

I mean the last line is a caused by, with the actual stacktrace missing

broken elbow
#

true. didn't even notice that.

lyric gyro
broken elbow
#

as sirywell mentioned, there's at least 1 line missing at the end

lyric gyro
#

Add me I'll send you a screenshot

#

I appreciate the help too 😄

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

merry knoll
#
    var text = text
        set(value) {
            entity.customName = Component.literal(value)
            field = value
        }

does the var text = text trigger the setter?
and which order does the code run? initializing variables first then the init block?

a bit of research says that init fires after the primary constructor before the secondary constructor but im not sure where variable initialization lies in the order

icy shadow
#

No it doesn't trigger the setter

stuck canopy
#

hey

#

Im trying to make a Spawner plugin

#

and is it possible to get the Spawner Item's Name or Lore which a player places and if It matches it then change the CreatureSpawner type

plush stirrup
edgy lintel
stuck canopy
plush stirrup
edgy lintel
edgy lintel
plush stirrup
#

If the cooldown is 30 seconds, i restart the server, the player still has a 30 second cooldown,
Example:
Start cooldown: 30 seconds left
cooldowncheckafter10seconds: 20 seconds left
restart server
cooldowncheck: 30 seconds left
cooldowncheckafter10seconds: 20 seconds left

stuck canopy
edgy lintel
stuck canopy
#

oh im sry I meant BlockPlaceEvent not BlockBreakEvent

edgy lintel
#

but a better way is save the cache into yml whenever it stops

#

and then load them back into the static map whenver it gets enabled again

plush stirrup
#

onEnable:

if (!(playerJobsCooldown.contains("data"))) {
            return;
        }
        for (String string : getPlayerJobsCooldown().getConfigurationSection("data").getKeys(false)) {
            UUID uuid = UUID.fromString(string);
            System.out.println(UUID.fromString(string));
            JobsJoin.cooldownMap.put(uuid, System.currentTimeMillis());
        }```

**onDisable:**
```java
for (Map.Entry<UUID, Long> entry : JobsJoin.cooldownMap.entrySet()) {
            UUID key = entry.getKey();
            long value = entry.getValue();

            try {
                playerJobsCooldown.set("data." + key, value);
                playerJobsCooldown.save(configFile);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }```
edgy lintel
plush stirrup
#

oh ok thx

merry knoll
#

does anyone know when ClientboundLevelChunkPacketData is sent to the player instead of the ClientboundLevelChunkWithLightPacket

#

i did quite a bit of testing but cant find any instance of the first packet being used

stuck canopy
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

stuck canopy
shell moon
#

I saw ItemMeta#getDisplayname() has @NotNull annotation, what it returns if nothing was set or null was set? returns empty string or what?

spiral prairie
shell moon
#

thats not possible

#

vanilla displayname depends on client locale

spiral prairie
#

Ok

shell moon
#

so cant retun "Black Stained Glass Pane" nor "Vidrio tintado de negro"

stuck hearth
#

d; spigot ItemMeta

uneven lanternBOT
#
public interface ItemMeta
extends Cloneable, PersistentDataHolder, ConfigurationSerializable```
ItemMeta has 33 methods, 3 extensions, 3 super interfaces, and  21 sub interfaces.
Description:

This type represents the storage mechanism for auxiliary item data.

An implementation will handle the creation and application for ItemMeta. This class should not be implemented by a plugin in a live environment.

shell moon
stuck hearth
#

Really?

lyric gyro
#

Spigot has less than the average brain cell count
Yes Zod

stuck hearth
#

"null" or null type?

lyric gyro
#

literally null, no object, nada
Because "yOu NeEd To ChEcK hAsDiSpLaYnaMe beFoRE cAllInG tHis MethOd"

stuck hearth
#

That's dumb

dusky harness
#

d;spigot ItemMeta#getDisplayName

uneven lanternBOT
#
@NotNull
String getDisplayName()```
Description:

Gets the display name that is set.

Plugins should check that hasDisplayName() returns true before calling this method.

Returns:

the display name that is set

dusky harness
#

Huh

#

💩

#

d;paper ItemMeta#getDisplayName

uneven lanternBOT
#
@Deprecated @NotNull
@NotNull String getDisplayName()```
Description:

Gets the display name that is set.

Plugins should check that hasDisplayName() returns true before calling this method.

Deprecation Message:

in favour of displayName()

Returns:

the display name that is set

dusky harness
#

Smh

lyric gyro
#

lol they reverted that?

dusky harness
#

Oh was it fixed before?

lyric gyro
#

Yeah

dusky harness
#

Huh

lyric gyro
#

Though the Component displayName variant is annotated as nullable

dusky harness
#

Wow

#

Paper really hates legacy

lyric gyro
#

I swear it was nullable lmao

dusky harness
#

Hm

#

maybe there are other not null methods that spigot fixed ¯\_(ツ)_/¯

#

That you confused it with

#

I wonder if paper would accept a pr to change that

dense drift
#

I think only lore was nullable

#

because for some reason, null and empty are two different things to craftbukkit

lyric gyro
#

oh yeah lore

#

I think

dusky harness
#

What why is lore nullable but name is not???

dusky harness
#

Wait

#

If u create 2 items

#

But in one of them you add empty lore

#

Will u see a difference

dense drift
#

I dont think so

dusky harness
#

Hm

lyric gyro
#

No

#

Basically: if there is no lore, there is no list to iterate and get any json from; if there is lore but it's empty, there are no elements to get any json from

hardy palm
#

How would yall go about modifying the format of the console log of chat messages in console?
For instance, currently if I send a message chat, the message sent to the console will show[current:time INFO] <MrMcyeet> Hey, I am a sample message!

If I wanted to change that to show the player's level, like [current:time INFO] <MrMcyeet [lvl. 8]> Hey, I am a sample message!how would I go about that?

viral moth
#

well

#

i mean if youre making it yourself just parse the text and put it before the second > or if youre doing anything special just break it up into sections like [name] [lvl] [message]

hardy palm
viral moth
#

personally id say cancel the event itself and send your own text to the game and your own text to the console

#

that might be the wrong approach tho... by wrong i mean just bad practice but i havent found anything in the API that would work for what you want

viral moth
fading stag
#

Should I reregister Placeholder Expansion on my plugin's reload command?

dense drift
#

No

iron karma
#

Hello, someone would recommend me something to add to this plugin?

torpid raft
#

but how about a limited amount of death

#

after the player dies x times they can't die anymore

#

very good idea would implement

shell moon
edgy lintel
#

@dusky harness cpp = best

dusky harness
#

Wrong!

#

kotlin obviously best 😌

stuck hearth
#

True

dense drift
#

So, I use the same testing setup for most of my plugins, and I decided to make a small gradle plugin where I could define some test servers with different versions, then create a task for each (e.g. testOn1_18_2) which would take the jar from shadowJar, put it on the plugins folder of the specified server and then start the server.
This is the Server class https://paste.helpch.at/utumenuyih.java and this is where the extension is registered https://paste.helpch.at/jiwehedetu.java, but for some reason getPaper() is false, even though I set it to true

testServers {
    create("1_18") {
        version.set("1.18")
        paper.set(true)
    }
}```
shell moon
#

you sure you didnt forget the this.paper = paper? xd

dense drift
#

paper.set(true)

shell moon
#

ahhh it was gradle xd

smoky hound
#

.getOrElse(false) in the extension paste you sent

#

may be using the or else value?

dense drift
#

well yeah, it is certainly using that, but I don't know why

#

ah, guess what, calling that method inside getTasks().register() returns the right value 🥲

#
        serverContainer.all(server -> {
            System.out.println("paper() is " + server.getPaper().getOrElse(false)); // false
            final String name = "testOn" + (server.getPaper().getOrElse(false) ? "Paper" : "Spigot") + server.getName();

            project.getTasks().register(name, Copy.class, task -> {
                System.out.println("paper() is " + server.getPaper().getOrElse(false)); // true
                task.setGroup((server.getPaper().getOrElse(false) ? "Paper" : "Spigot") + " testing");
                task.from(shadowJar);
                task.into("./servers/." + name.replace("testOn", "") + "/plugins");
            });
        });```
#

I will just guess that what I'm trying to accomplish is not possible

dense drift
#

Alright so I need help with something much more important xD
So, for some reason, on older versions, a variable "lose" the link to player's item in a certain circumstance.
I got this vouchers plugin and it has a confirmation feature where a GUI is opened when you try to use the voucher. The item I get from PlayerInteractEvent I pass to the confirmation GUI, and after the player clicks on "Confirm", the redeem() method is called and at the end of this method, 1 should be subtracted from item's amount.

PlayerInteractEvent

final ItemStack item = getItemInHand();

if (voucher.hasConfirmation()) {
  openConfirmation(player, item);
} else {
  redeem(player, item);
}```
> openConfirmation();
  • Create GUI
  • Add all items
  • Set the action for the "confirm" button to call redeem(player, item);
> redeem();
```java
item.setAmount(item.getAmount() - 1);```

Now, the problem is that when confirmation is enabled, the stack amount remains the same. The only difference between "with confirmation" and "without confirmation" is the GUI, but inside the gui I call the same `redeem()` method.
shell moon
#

looks nice to read, but too much text xd

lyric gyro
#

yeah lol

shell moon
#

easy

#

grab one item, open the menu

#

listen to close event, if not redeem, return the item

#

(i think i'll make a vouchers plugin, looks fun)

dense drift
#

Smh guys

leaden sinew
torn heart
#

right now i'm working on adding inaccuracy for guns in my game. the idea is that i have a direction in which a bullet is shot, and inaccuracy adds on to that. in cs for example, it's measured in the farthest distance a shot is guaranteed to hit a 30cm plate. this means that max offset is (0.3/2)/distance. to generate randomness like this, the easiest way is with a polar coordinate grid, with this code: java float theta = (float) (r.nextFloat() * 2 * Math.PI); float random = r.nextFloat(); Vector inaccuracy = new Vector(random * Math.cos(theta), random * Math.sin(theta), 0); this generates a random position along the x and y axis. my problem is that i need to add inaccuracy to a vector called direction, but i first would need to rotate the inaccuracy vector, and this is out of my mathematical knowledge and google hasn't been much help. if anyone could lend a hand to the problem that would be nice. i'm currently just spawning particles to simulate the endpoint of a shot.

shell moon
leaden sinew
# shell moon how xd

If the server crashes while the player is in the confirm menu, they lost a voucher that was never actually redeemed.

shell moon
#

ahh, yeah ofc

#

¯_(ツ)_/¯

solemn ocean
#

Any math pro or whatever that can help me? I have a start location, and a direction, I need to check if at a certain distance following that direction from start location there is a block, anybody knows?

high edge
#

Raycast?

sterile hinge
#

at a certain distance or up to a certain distance?

forest jay
#

I am making a plugin that needs to efficiently check if a player passes through a very small 3x1 passage. I know how to do it with the PlayerMoveEvent, but that doesnt seem efficient. There will be mutliple of the passages, so checking each one doesnt sound too great. Is there another way I could about this? (I dont want to have to use WorldGuard or any plugin like it)

#

Would packets instead of events be a viable option?

molten wagon
#

I´m confused abut this error https://paste.helpch.at/atanugorud.bash I know the error, but not way it print error. Look more like the method spigot/bukkit use ignore the if check I have and try load every class in the method i have.

dense drift
#

Show some code

dusky harness
#

and somewhere

#

it needs that class

#

I think in config?

#

whatever config is in SimpleYamlHelper line 138

#

Do you have particles in your config

molten wagon
molten wagon
neat pierBOT
molten wagon
#

Yes that are the plan 🙂 it should right now only load on 1.17+ (but ignoring the check right now).

dense drift
#

wait wtf

#

Yeah I read that wrong, sorry

molten wagon
dense drift
#

can I see your config?

#

I have a feeling that a DustTransition is deserialized in there and when the file is loaded it can't find that class
this.customConfig = YamlConfiguration.loadConfiguration(file);

molten wagon
#

I don´t have DustTransition or DustDustOptions in the file. So only way it can read that classes thru the ParticleEffect class

dense drift
#

ah, I think I see

#

You are checking if the server version is newer than 1.16, which 1.16.5 (or what 1.16.X version you have) is, but the class exists only on 1.17

#

Change the check to "newer or equal to 1.17" or something like that

molten wagon
dense drift
#

I don't think it does

molten wagon
#

I my own custom method so 🙂

dense drift
#

Also, is that the only config you have?

molten wagon
dense drift
#

when you remove what?

molten wagon
dense drift
#

System.out.println("ServerVersion.newerThan(ServerVersion.v1_16)######## " + ServerVersion.newerThan(ServerVersion.v1_16)); is this false?

molten wagon
molten wagon
dense drift
#

and if you add that commented out method back?

molten wagon
sterile hinge
#

it fails when looking up the method via reflections

#

might be related to how stack frames etc work

#

you could try to move the Particle.DustOptions dustOptions = null; into the if block

molten wagon
sterile hinge
#

ah wait it's the transition class that is missing

#

you could probably extract that part into a different method, and pass the map and the builder to it

molten wagon
dusky harness
#

or why not just use 1.16 api?

molten wagon
molten wagon
dusky harness
molten wagon
molten wagon
sterile hinge
#

but an extra class shouldn't be needed

molten wagon
sterile hinge
#

the class is loaded anyways

#

it's only about the method

molten wagon
sterile hinge
#

that's why I said you should pass the builder and the map to the method

molten wagon
sterile hinge
#

can you share the exact exception for that code?

molten wagon
pure crater
#

Guys, im really lazy and I don't want to initialize all those fields. The value of those Strings is the same as the name of the constant lowercased and all _ turned into dashes. I know this is fucky but can I just do this out of pure laziness: https://paste.helpch.at/relehetobi.java

molten wagon
#

enum (if the value is constant)? or what is your plan?

pure crater
#

Well i mean

#

Yeah no i cant

#

I mean I could make a separate enum class for it perhaps

#

And then do something like getKeyName() or something

#

but i prefer using actual String constants instead

molten wagon
pure crater
#

its a class for storing constants

#

And also a class to be usable

molten wagon
pure crater
#

OutputConfigurator is an abstract class.
VLCTranscoderOutput is a "marker" class. It also holds constants specific to VLC

#

I think its fine tbh

#

I mean marker class as in like something similar to marker interfaces

#

OutputConfigurator must be abstract class as it contains method logic (with maps ands tuff)

#

So I can't use interface and define constants in interface

molten wagon
dusky harness
pure crater
#

Im lazy

dusky harness
#

How about I do it for you

#

😃

pure crater
#

wel

#

well

dusky harness
#

or do you want to keep it

pure crater
#

i dont want to put someone into that pain

#

so

dusky harness
#

like where its not a hardcoded string

#

if that makes sense

pure crater
#

ill do it myself

#

lmao

dusky harness
#

🥴 how about I do the ones lines 29 and below

#

😌

pure crater
#

Lol its fine

#

i got it

dusky harness
#

wait but does that code actually work

pure crater
#

ya

#

lol

dusky harness
#

oh wait yea

#

i was thinking that it would say that it's not initialized

pure crater
#

ill just write code to write code

#

XD

dusky harness
#

but I forgot that it only does that for methods

dusky harness
dusky harness
#

but that's just my thought about writing code to write code which may or may not take longer to write code without writing code to write the code for you

molten wagon
#

code some is never get written is the fastest code XD

dusky harness
#

🙃

molten wagon
# molten wagon https://paste.helpch.at/agoqiganim.bash It will not point directly to right clas...

Seams like only way I can do it (if I not move the logic for ConfigurationSerializable to other class or made my own serializer (I think is not to hard, but I think that will be some challenge to get it work with spigot api)) https://paste.helpch.at/ahegulezon.http .

So moved both DustOptions and DustTransition to other class (i think older mincraft versions don´t have DustOptions ether (need check that up too)). Need do some more clean up, but have at least some sort of baseline now.

merry knoll
#

more of an architecture question, i am making an api for armor stand holograms

since holograms are player specific (aka packet based), whats the best way to cache them?
keep holograms cached per person (the ones they can see) or store uuid of people that can see under the hologram objects?

both dont feel proper for some reason cleaning after players as they leave with the second option is a pain and with the first one deleting the holos becomes a pain

molten wagon
merry knoll
molten wagon
merry knoll
#

currently my hologram object wraps a fake entity and sends its to whoever needs to see it

#

but i am not sure if i should store the players that can see in the hologram object or store the holograms under internal player wrapper objects

molten wagon
dense drift
#

Yaml should only look for 1 of 3 methods for deserialization though

#

A static method "deserialize" that accepts a single Map< String, Object> and returns the class.

A static method "valueOf" that accepts a single Map<String, Object> and returns the class.

A constructor that accepts a single Map<String, Object>.

sterile hinge
#

reflection still looks up all methods internally

dense drift
#

Oh really?

sterile hinge
#

In current implementations, yes

dense drift
#

Hmm, annoying

#

Id suggest to use a proper storage instead of YAML. And if thats not a storage, the default serialization looks disgusting imo (==: path.to.Class)

molten wagon
#

Yeah , I will test something later and see if that will fix it.

Add a if check on the second method.

molten wagon
#

You get yaml error when start the server xD

sterile hinge
#

Yeah but in the jdk

lyric gyro
#

Oh, that you mean

molten wagon
# sterile hinge Yeah but in the jdk

You seams to have right.

I try this , give me error (even if this return false , but somehow java ignore it )


    public Particle.DustOptions something(ParticleDustOptions options) {
        if (ServerVersion.newerThan(ServerVersion.v1_16))
            return new Particle.DustTransition(Color.FUCHSIA, Color.AQUA, 1);
        return null;
    }

So I try something stupid and the error is now gone.

    public Particle.DustOptions something(ParticleDustOptions options) {
        if (false && ServerVersion.newerThan(ServerVersion.v1_16))
            return new Particle.DustTransition(Color.FUCHSIA, Color.AQUA, 1);
        return null;
    }

#

I think they should use better method to get deserialize() method an blindly try find it.

sterile hinge
#

There is no better way than that when using reflections

molten wagon
#

hm lol was not my plan to ping random .

dense drift
#

Because you cant implement/override static methods

sterile hinge
dense drift
#

Wait, is that caused by Class#getMethod ?

molten wagon
molten wagon
dense drift
#

The problem was your method that returns the class that doesnt exist, I believe you can just get rid of that method - since all it does is to call a constructor

molten wagon
dense drift
#

I mean, replace that method with the constructor call

molten wagon
sterile hinge
torn heart
#

i have a for loop: ```java
for (float d = 0; d <= distance; d += accuracy) {
System.out.println(d);

        if (d >= distance) {
            System.out.println("reached distance");
        }
    }```

why is the if statement never reached?

shell moon
#

bc if d is 10 and distance is 10, d is lower equal than distance but also greater equal than distance

torn heart
#

and?

#

in that case the if statement would be called and "reached distance" would be outputted

#

but it's not

dense drift
#

Well, is the last value printed >= than distance?

torn heart
#

no

#

it's distance - accuracy

#

i'm using the values distance = 40 and accuracy is 0.2

#

last value printed is 39.8

dense drift
#

Probably a problem caused by decimals

torn heart
#

yea but how do i fix it

stuck hearth
#

That doesn't look like the full code

torn heart
#

it is

#

just ran it, has the issue, i just want to know why this isn't working

stuck hearth
#

Does it just recurse infinitely then?

torn heart
#

no it exists the for loop

#

without calling the if statement

stuck hearth
#

Yeah I think it'd because it's equal and then exits before looping again

torn heart
#

what

stuck hearth
#

d == distance

torn heart
#

that's not in my code

stuck hearth
#

No its not

torn heart
#

also it doesn't loop again

#

it's not recursive

stuck hearth
#

the loop hits 39.8
loops, hits or goes above distance
and then terminates

torn heart
#

nvm i figured it out

torn heart
#

wait

#

yea i think what's happening is it's reaching 39.8, rounding error happens, goes to > 40 so it's not run again

#

k thanks

stuck hearth
#

No

torn heart
#

what

#

why not

stuck hearth
#

The for loop is incrementing after the loop, so the boolean condition is checked then, and doesn't loop again

#

Your if statement can never be reached

torn heart
#

isn't that exactly what i said

stuck hearth
#

You said it was a rounding error, that is not the case

torn heart
#

the condition is false because it goes over 40

torn heart
#

38.800076 [13:55:48] [Server thread/INFO]: 39.000076 [13:55:48] [Server thread/INFO]: 39.200077 [13:55:48] [Server thread/INFO]: 39.400078 [13:55:48] [Server thread/INFO]: 39.60008 [13:55:48] [Server thread/INFO]: 39.80008

shell moon
#

me too lmao

stuck hearth
#

Oh I see now

shell moon
#

as double

lyric gyro
#

consider using BigDecimal

stuck hearth
torn heart
#

finally i got my spread mechanic working

#

it's beautiful

molten wagon
grave wind
#

Hey everyone I was wondering if anyone knows an easy way to modify player attributes with KubeJS, I want to make a simple system for scaling player health, adding and keeping additional permanent hearts after death

#

Please ping me @grave wind

stuck hearth
# merry knoll but i am not sure if i should store the players that can see in the hologram obj...

The observer pattern is a software design pattern in which an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
It is mainly used for implementing distributed event handling systems, in "event driven" software. In those s...

merry knoll
wintry grove
#

👉 👈

#

the code does what its supposed to do

#

which is weird now that I think about it

#

but it shoots that exception every time I write a letter after I do the command

leaden sinew
wintry grove
#

59

#

if(subCommand.getName().charAt(0) == args[0].charAt(0)) {

#

this if

leaden sinew
#

So either the sub command name or args[0] is empty

wintry grove
#

I dont think so

#

becuase it does complete if I put the right letter

leaden sinew
#

That's a runtime error

#

Not compile time

#

Oh sorry

wintry grove
#

oh

leaden sinew
#

Thought you said compile not complete

lyric gyro
#

if(args.length > 0) will always be true, and right after you type a space it will be an empty string

wintry grove
#

so it gets trolled

lyric gyro
#

so charAt(0) fails

wintry grove
#

ohhhh

#

it doesnt throw the error if I do a letter

#

thats why

#

what should I do to check that?

#

or do I just ignore it

lyric gyro
#

if !args[0].isEmpty

#

i guess

wintry grove
#

gonna try

#

thanks

#

works

#

ty

lyric gyro
#

epic

stuck hearth
#

O(1)

molten wagon
lyric gyro
#

im getting this in mc chat once i try to give myself a custom pickaxe

#

An error occurred while processing your command
Message: IllegalArgumentException:
java.lang.ClassCastExpception@781f94a2
Exception: java.lang.reflect.InvocationTargetException
Details:
sun.reflect.NativeMethodAccessorImpl.invoke0(Native

high edge
#

Not the full error, would assume there's an issue with your command class then

echo igloo
#

Hello, I've been trying to make this Server List MOTD thing in my plugin but I don't know how to make a multiline MOTD that is using the config.
For Example:
Config

motd:
 - "&c&lLine test number 1"
 - "&a&lLine test number 2"
high edge
#

Append \n after each line and it should split them, or whatever the splitterator for motds is

echo igloo
#

Is there any loop that checks all the strings in Motd and automatically adds a splitter?

high edge
#

loop through the config lines and add it?

echo igloo
#

yeah

#
    @EventHandler
    public void onServerListPing(ServerListPingEvent e){
        StringBuilder motdList = new StringBuilder();
        for(int i = 1; i < utils.getConfig().getList("motd").size(); i++){
            motdList.append(utils.getConfigString("motd") + "\n");
        }
        String motdappear = motdList.toString().trim();
        e.setMotd(utils.translateColors(motdappear));
    }
#
motd:
  - "&c&lTEST Number 1"
  - "&a&lTest number 2"
#

It doesn't work

spiral prairie
#

Like what part doesnt work

echo igloo
#
    public void onServerListPing(ServerListPingEvent e){
        StringBuilder motdList = new StringBuilder();
        for(int i = 0; i < utils.getConfig().getStringList("motd").size(); i++){
            motdList.append(i + "\n");
        }
        String motdappear = motdList.toString().trim();
        e.setMotd(utils.translateColors(motdappear));
    }
#

This is the new code

#

it does separate the line but it doesn't get the strings and type it as
0
1

spiral prairie
#

yeah obviosly

dense drift
#

String.join("\n", utils.getConfig().getStringList("motd"))

spiral prairie
#

^

echo igloo
#

where should I type that

dense drift
#

Replace what's above e.setMotd with that

echo igloo
#

and what should I type inside the e.setMOTD?

#

I'm new to java coding and I'm trying my best so sorry if I don't really understand what you're saying

dense drift
#

String motd = String.join("\n", utils.getConfig().getStringList("motd")); and then use this instead of motdappear

echo igloo
#

Yeah I figured this out, Thanks a lot

#

It's working!

dense drift
#

What that String#join does is to combine all the string together and add a "\n" in between

echo igloo
#

So I should keep the loop right?

broken elbow
#

no

echo igloo
#

Is there any way I can center the motd text?

broken elbow
#

spaces

echo igloo
#

I have another question. I'm trying to make this PvP Stats thing but I don't know how to make multiple HashMap stuff like HashMap<Player, Kills, Deaths, KD, Cash>

dusky harness
# echo igloo I have another question. I'm trying to make this PvP Stats thing but I don't kno...

You can't, so you'd have to make a class called like PlayerData for example
then the map would be HashMap<UUID, PlayerData> (don't use Player because it can invalidate itself whereas the UUID can't)
The PlayerData class would look something like ```java
public class PlayerData {
private int kills;

public int getKills() {
    return kills;
}

public void setKills(int newKills) {
    kills = newKills;
}

}

echo igloo
#

and if I want to set the amount of kills for a player?

#

how would it look like?

dusky harness
#

whoops, forgot about that

#

I edited the code

echo igloo
#

and It'll work?

#

lemme check 🙂

#

thanks

#

Should I edit the code to this?

    private int kills;

    public int getKills() {
        return kills;
    }

    public void setKills(UUID player, int newKills) {
        kills = newKills;
    }
}
reef bough
#

hello

#

i need to help

hoary scarab
#

With?

reef bough
#

can you message on me private ?

hoary scarab
#

If you want

reef bough
#

deluxetags have one bug

#

i cant drop screenshot here

hoary scarab
#

?imgur

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

stuck hearth
#

Oh shit is yappers going to click a link

merry knoll
#

sending remove entity packet followed by entity spawn packet to update an entity seems to sometimes make the entity disappear clientside

#

does anyone know why that happens?

#

(only seems to happen at older versions)

torn heart
#

i'm currently using BoundingBox#raytrace to check if a a block was hit, and my problem is that the bounding box for stairs is a cube, not actually a stair. anyone know how to fix this or get around it?

lyric gyro
#

what version?

torn heart
#

1.17

stuck canopy
#

help

#

    public static ItemStack CaveSpiderSpawner;
    public static ItemStack Placeholder;
    public static ItemStack SpawnerItem;

    public static void init() {
        createSpawner();
    }

    public static void createSpawner() {

        ItemStack caveSpider = new ItemStack(Material.SPAWNER, 1);
        BlockStateMeta meta = (BlockStateMeta) caveSpider.getItemMeta();
        meta.setDisplayName("Cave Spider Spawner");
        List<String> lore = new ArrayList<>();
        lore.add("Place this to get a Cave Spider Spawner");
        meta.setLore(lore);
        CreatureSpawner cs = (CreatureSpawner) meta.getBlockState();
        cs.setSpawnedType(EntityType.CAVE_SPIDER);
        meta.setBlockState(cs);
        caveSpider.setItemMeta(meta);
        CaveSpiderSpawner = caveSpider;```
#

why does this only work when im in creative mode

high edge
#

:what the:

stuck canopy
#

when I place that spawner in creative mode it works but when I place it in survival mode it doesnt

#

im confused

#

why does that happen

torn heart
#

why do your variables start with a capital letter

stuck canopy
#

how is it related to my problem

torn heart
#
  1. get help (joke)
  2. show the full code
stuck canopy
#

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Player p = (Player) sender;

        if (command.getName().equalsIgnoreCase("spawner")) {
            if (args.length == 0) {
                p.sendMessage(ChatColor.RED + "Please enter a MobType!");
            }
            if (args[0].equalsIgnoreCase("cave_spider")) {
                p.getInventory().addItem(CaveSpiderSpawner);
            }
        }
         return true;
    }
}```
#

    @Override
    public void onEnable() {
        // Plugin startup logic
        Spawners.init();
        getServer().getPluginCommand("spawner").setExecutor(new Commands());

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}```
#

thats all the registered code

dusky harness
#

or whatever the default is

stuck canopy
#

but when im in creative mode it changes the spawner entity type when placing the spawner

#

I mean when I place the spawner in survival mode its a pig spawner but when I place it in creative mode its a cave spider spawner

edgy hearth
#

hi, how can I remove a mod item from the player's inventory using a plugin? (I'm using mohits) ?

pure crater
#

dont use mohist please

#

extremely buggy

stuck hearth
#

This is the true solution

leaden sinew
#

https://github.com/HibiscusMC/HMCCosmetics/blob/449fc8a84be91c95e15cfdafbf397d61db542879/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java#L364

error: cannot find symbol
            } else if (slot == com.github.retrooper.packetevents.protocol.player.EquipmentSlot.CHESTPLATE) {
                                                                                              ^
  symbol:   variable CHESTPLATE
  location: class EquipmentSlot

Does anyone have any ideas what could be causing this? It was working perfectly fine and suddenly it stopped working, and IntelliJ doesn't give any warnings.
When I try to compile, I get that error.

#

Did I just do something dumb or something?

#

Please ping me if you respond

leaden sinew
#

Its from PacketEvents, not Spigot

dusky harness
#

in packetevents (at least in the latest version) it's CHEST_PLATE

#

in spigot it's just CHEST

leaden sinew
#

What the heck

#

Why is IntelliJ telling me something different

dusky harness
#

🥲

#

wait

#

what repo are you getting packetevents from

leaden sinew
#

jitpack

dusky harness
# leaden sinew jitpack

maybe refresh gradle dependencies 🤷

IntelliJ might not have updated since it was changed recently

leaden sinew
#

I guess invalidating caches didn't work

dusky harness
#

yea iirc that only invalidates intellij caches

#

not gradle

leaden sinew
#

Yep that worked, thank you!

stuck canopy
#

how do I remove a ItemStack from player's Inventory when its stacked

#

like more than 1 of the item

dense drift
#

item.setAmount(item.getAmount() - 1)

stuck canopy
#
    public void onClick(InventoryClickEvent e) {
        if (e.getClickedInventory() == null) {
            return;
        }
        if (e.getClickedInventory().getHolder() instanceof SpawnerInventory) {
            e.setCancelled(true);
            Player player = (Player) e.getWhoClicked();
            if (e.getCurrentItem() == null) {
                return;
            }
            if (e.getCurrentItem().getType() == Material.GREEN_WOOL && player.getInventory().containsAtLeast(CaveSpiderSpawner, 1)) {
                player.getInventory().remove(CaveSpiderSpawner);
                Block block = player.getTargetBlockExact(4);
                player.sendMessage(block.getType().name());
                CreatureSpawner cs = (CreatureSpawner) block.getState();
                cs.setDelay(cs.getDelay() - 1);
                cs.setRequiredPlayerRange(cs.getRequiredPlayerRange() + 1);
                cs.setMaxNearbyEntities(cs.getMaxNearbyEntities() + 1);
                cs.update(true);
                player.closeInventory();
            }
        }
    }
}```
#

how do I use it in my code

#

I used player.getInventory().remove(CaveSpiderSpawner) which doesnt work

hoary scarab
#

If its a specific ItemStack (including the amount), use Inventory.removeItem()

pastel umbra
#

Quick question, is having for example 2 PlayerJoinListeners bad practice? should i just have one with all my code in it or does adding another one cause problems?

spiral prairie
#

Bad practice ig

#

Just have seperate methods for sepetate functions

sterile hinge
#

having separate listeners for separate things for the same event is totally fine

shell moon
#

When does LivingEntity#getEquipment() returns null?

#

i mean, in which mobs exactly? thonking1

proud pebble
#

i think all mobs can have armor equipped

shell moon
#

i believe so

proud pebble
#

might not be visible tho

shell moon
#

i mean, creepers cannot display helmets

#

but i think they can have

proud pebble
#

yeah

shell moon
#

can someone check the code

#

xd

proud pebble
#

cant you check the code?

#

Its just net.minecraft.server's livingentity class

shell moon
#
    if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
        equipment = new CraftEntityEquipment(this);
    }
shell moon
#

Block#getLocation().getX() always returns number like 100.0 right?

#

not 100.4, 200.54, always 200.0 with one decimal (which is 0) am i right?

wintry grove
icy shadow
#

getBlockX

#

etc

shell moon
#

yeah ik it returns int

#

question is getX related, always .0? eyes_shake

icy shadow
#

dunno

wintry grove
#

dunno

icy shadow
#

but if you want the .0 just use the int version

wintry grove
#

I mean

shell moon
#

i dont want

wintry grove
#

you can also check the javadocs

shell moon
#

i wanna know if it returns .0 or not

wintry grove
#

if it returns an int or a double

steady ingot
#

I thought that it always rounds to .5 ¯_(ツ)_/¯

shell moon
#

getX returns double

steady ingot
#

Idk, haven't touched it in a while

shell moon
#

question is if its .0 or .5

icy shadow
#

why does it matter?

wintry grove
shell moon
#

because some dumb dev "stringified" location like getX + getY + getZ + world name

wintry grove
icy shadow
#

^

#

ok so what?

shell moon
#

and i wanna "process" it to convert to something like

#

getBlockX;getBlockY;getBlockZ;worldname instead

wintry grove
#

and?

icy shadow
#

ok so do that

#

problem solved

wintry grove
#

^

shell moon
#

and, getX+getY+getZ+worldname means

#

output is

steady ingot
#

or if you so pleased, you could just store the entire Location object

shell moon
#

"100.040.01200.0world"

icy shadow
#

then that looks like your question is answered

shell moon
#

maybe

#

i'm guessing

wintry grove
#

if you want to make it a string use String.valueOf

#

easy

shell moon
#

wow, wouldnt have imagine it

wintry grove
#

woah

torpid raft
#

alonso i dont get what your question was

icy shadow
#

dude im so confused rn

wintry grove
#

I reinvented the wheel

#

and you confused einstein's corpse

shell moon
#

i guess i'll simply check if it returns .0 always and use some regex or something

wintry grove
#

breh

shell moon
#

to split strings, parse to double/int and then save it again

icy shadow
#

you couldve just tried it by now

wintry grove
#

^

icy shadow
#

why cant you just change the stringify method...?

shell moon
#

i need to open mc

#

thats why i'm asking now

wintry grove
#

use the console lmao

icy shadow
#

literally no you dont

#

^

wintry grove
#

make it place a block

icy shadow
#

just pick a random block in the world and try it

wintry grove
#

then get the position

shell moon
#

fun fact

wintry grove
#

hoo lee sheet I dont know how to talk

shell moon
#

was asking cuz i dont wanted to start the server

wintry grove
#

bruuuuuuh

shell moon
#

yeah, you got the idea

wintry grove
#

its like

#

one button

torpid raft
#

alonso what is the capital of hungary

wintry grove
#

or one like of terminal

shell moon
torpid raft
#

if u + x = 12 then u must be 2 because u are a 10

wintry grove
#

I'm going to try it

#

copilot did most of that lmao

shell moon
#

getX

#

not getBlockX

wintry grove
#

wait true

shell moon
#

this is waht the dev did

#
return (l.getX() + "." + l.getY() + "." + l.getZ() + l.getWorld().getName()).replace(".", "");
#

imagine

wintry grove
#

why did paperweight need to reinstall the sources

#

annoyed

sterile hinge
#

must be a real genius

shell moon
#

believe it or not

#

it returns

98405609850world

#

omg, this is impossible

#

nvm, i'll remove old data

#

¯_(ツ)_/¯

sterile hinge
#

why doesn't that contains . now?

dense drift
#

:))

shell moon
#

because it replaces . with empty

#

i tho i could use the point as a reference

#

butits simply impossible

dense drift
#

Cant you just change the system to use like ; or whatever?

shell moon
#

yeah, but saved data

#

i really wanted to convert it to the new format

#

but since it doesnt even have periods to recognize the numbers

#

its simply impossible now

dense drift
#

Is there no deserialization method?

shell moon
#

ofc no

icy shadow
#

it wouldnt be possible to write one

#

it's erasing too much information

shell moon
#

current method is

return (l.getX() + "." + l.getY() + "." + l.getZ() + l.getWorld().getName()).replace(".", "");

dense drift
#

Get rid of the replace

shell moon
#

if string contains only three zeros

#

would be possible

#

but if it contains more than 3

#

not possible

shell moon
#

thing is how to convert data created with that format

#

into something readable x;y;z;name

#

as double was used, means that numbers had a .0

#

so if 98405609850
if will be 984.0 56.0 985.0

sterile hinge
dense drift
#

What about split(".0")

shell moon
#

but if 90405609850
how to know if its 9.0 4056.0 985.0 or 904.0 56.0 985.0 or any possibility

sterile hinge
shell moon
#

current method saved data like this

dense drift
#

Get rid of the replace, I said it before

shell moon
#

man

#

issue is not how to format

#

is how to transform already created data

#

into the new format

sterile hinge
shell moon
#

basically

#

how to get x, y, z and name

#

from this

dense drift
#

How does that person even use the data wtf

shell moon
#

And the main issue is:

if 98405609850
if will be 984.0 56.0 985.0 = easy

but what if 90405609850
how to know if its 9.0 4056.0 985.0 or 904.0 56.0 985.0 or any possibility

shell moon
#

and i dont even try to understand why would someone even do that xd

sterile hinge
shell moon
#

if 3 zeros

#

yes

sterile hinge
#

that's why I asked the question which you ignored

shell moon
#

if more, impossible

dense drift
#

Ye, too many posibilities

shell moon
#

yeah, with one more 0

#

possibilities are simply

#

uff

dense drift
#

Ywell ^

shell moon
shell moon
#

thats the current method

#

why, man, i ask the same

#

when i wake up

dense drift
#

Search for a reading method, I assume they saved the coords for a reason

shell moon
#

yeah, ofc, but why in that way

#

i mean, there were so many ways

#

location could have been stored

dense drift
#

Thats not your problem

sterile hinge
#

doesn't matter if there's a method to read it, because it will definitely yield wrong results

shell moon
#

i wnt to support old data

#

but i guess it's not possible

#

if it only had one symbol or sth

dense drift
#

Maybe they came with a solution to their stupid idea, Ywell

sterile hinge
#

well there's no correct solution

shell moon
#

definitely not this

dense drift
#

What are these coords for anyways?

shell moon
#

spawner

dense drift
#

My point is, you dont just store some coordinates, there should be a reason, and also a reading method imo

shell moon
#

yes

#

you'll laught with it

sterile hinge
#

10101010 if you want a simple example, there are three possibilities what it could mean

shell moon
#

see

#
String getLocationName(Location l) {
    return (l.getX() + "." + l.getY() + "." + l.getZ() + l.getWorld().getName()).replace(".", "");
}
dense drift
#

Is this shit on github?

shell moon
#

to save:

shell moon
#

String name = getLocationName(player.getTargetBlock(null, 25).getLocation());
files.getSaved().get().set("path." + name, delay);

#

when needed:

Listening to CreatureSpawnEvent:
String name = plugin.getLocationName(spawner.getLocation());
if (plugin.getFiles().getSaved().get().contains("path." + name)) {

dense drift
#

Wew

broken elbow
dense drift
#

Man this is fucked up lmao

shell moon
#

they simply serialize it the same way

broken elbow
#

I didn't read the whole conversation. I just thought its your idea xD

dense drift
#

Where do you get this from, duh?

shell moon
#

and if it matchs, it matchs xd

#

why eyes_sus

#

dont kill the person ok?

dense drift
#

Is it a public plugin?

shell moon
#

yes

#

kinda well known

dense drift
#

Blitz when did you made this?

shell moon
#

ppl asked for help with it some times

dense drift
#

Link?

broken elbow
shell moon
dense drift
#

No

shell moon
#

don't ask me why i want to understand the code, ok?

dense drift
#

Just send the link ffs alonso

shell moon
#

let me search what ffs is

broken elbow
#

for fuck sake

#

I was going to make a joke but can't be bothered rn

shell moon
#

ahhh

broken elbow
#

Oh lmao.

#

Its that one

#

I've seen this

shell moon
#

shhh

broken elbow
#

had to close the link after reading the few lines

shell moon
#

hahaha

dense drift
#

Smh

#

So, whats the plugin, alonso?

shell moon
#

||infernal_mobs.java||

dense drift
#

No way

shell moon
dense drift
#

And the real name?

shell moon
#

thats the name

dense drift
#

Ok

lyric gyro
#

Hey,
So I want to place blocks with a delay but it gives me error when i use runTaskAsynchronious thingy. is there a other way?

#

you can't place blocks asynchronously

#

needs to be done on the server thread

#

(I mean if you go deep enough, you "can" but you're gonna break more stuff than what you're trying to solve)

merry knoll
#

i mean you can

#

but if you want to avoid corrupting your world you have to do

  1. go to another thread (runtaskasync)
  2. do stuff (if you are doing heavy calculations etc)
  3. go back to main thread
  4. place blocks
lyric gyro
#

yeah the actual block placement needs to be on the server thread

merry knoll
#

chances are the thread switching you are doing is more costly than just doing it on the main thread if you only need a delay with no big calculations

lyric gyro
#

and the fact you need to wait until the 50ms tick period is over for the task to run kekw

shell moon
#

if a BlockBreakEvent has priority LOWEST and in it you .steCancelled(true) and setType(AIR),
if another BlockBreakEvent has priority HIGHEST, it would return getType() == AIR right?

winged pebble
#

Seems right

shell moon
#

So basically, there is no way to know what type it was originally i guess

blazing lake
#

Where should the variable expansion problem go?

shell moon
#

I seriously don't understand the question

proud pebble
pastel umbra
#

Quick question, if you were to make a rank/group plugin and you were to display the rank next to the name everytime they wrote something (anywhere, private chats etc) what would be the best way to do it? Maybe to replace getName() or getDisplayName() somehow?

wheat carbon
#

This doesn't answer your question

#

but that's really not something you should be doing

#

it's out of scope for a permissions plugin

#

it's the job of the chat plugin

#

your plugin needs to provide a method to get a player's rank, for example through placeholderapi, or through vault

pastel umbra
#

Doesn’t answer my question? What do you mean? Why would i answer my own question?

wheat carbon
#

what I said doesn't answer your question

pastel umbra
#

i was asking if there was a more efficient way of doing it

#

if i dont wanna use placeholderapi or vault

wheat carbon
#

those were examples

#

there was a message before the examples, that's what I want you to consider

pastel umbra
#

Sure, chat plugin

#

So replacing getName or getDisplayName wont be efficient?

wheat carbon
#

again it's not a matter of efficiency, moreso that it's out of scope for a permissions plugin to be doing that

#

there's no question of efficiency in regards to chat

#

it's not a demanding part of the server

pastel umbra
#

I would prefer not having a method called all the time

wheat carbon
#

why?

lyric gyro
sterile hinge
lyric gyro
#

Thousands of them

#

Hundreds of thousands of them

pure crater
#

Millions

lyric gyro
#

ONE BILLION

spice river
#

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

its not adding the enchantment
ive tried it in another class and it works there(its literally the same way of adding the enchant)
i didnt add the full code because there are alot more lines doing the same thing with another enchants. i know its inefficient
the problem is this item.addUnsafeEnchantment(Pit_Gui.fletching, 3);

sterile hinge
pure crater
pastel umbra
#

My question still remains unanswered

#

Theres no way the only way to do this is through a method like that

#

Because using getName() on some permission plugins displays the rank but getDisplayName() doesn’t

sterile hinge
#

I really don't understand your issue

pastel umbra
#

Can u read it again then...

spice river
#

maybe try setDisplayname

lyric gyro
#

I mean if you "genuinely don't care" and you don't care about compatibility with chat and tab list plugins, Vault and all that, then stop asking for advice and do whatever you want

#

if you do want to retain compatibility with other plugins so they use your stuff then you gotta do that

pastel umbra
#

i don’t care about using a method everytime im doing something with chat if theres a more sufficient way?

sterile hinge
#

getName and getDisplayName represent different concepts. You should always use the display name if you want to, well, display the name. But including additional information in the display name might result in unexpected behavior

lyric gyro
pastel umbra
#

getName: the actual name of the player (not changeable through bukkit api)

getDisplayName: the name that is displayed in the chat (this is changeable)

#

theres my answer i think.

pastel umbra
lyric gyro
#

Usually display name is for stuff like custom nicknames rather than chat prefix/suffix, because when someone runs /nick it will be replaced

icy shadow
#

it's almost as if there's a reason permissions plugins dont do this

pastel umbra
#

What do permission plugins do?

icy shadow
#

permissions

pastel umbra
#

can you explain in a short way just regarding the chat?

pastel umbra
#

do they call a method everytime somebody sends a chat?

icy shadow
#

a "proper" perms plugin doesnt have anything to do with the chat

#

you'd use something like PAPI to get the player's prefix or whatever and put it in your chat format

pastel umbra
#

and if i didn’t wanna use papi?

#

if i wanted to do my own implementation

icy shadow
#

¯_(ツ)_/¯

#

who knows

#

but displayName will be overriden by some things

pastel umbra
#

I guess i will just go with a method

icy shadow
#

a method...?

#

are you making a chat plugin or a permissions plugin here?

pastel umbra
#

well im making a permission plugin, but the permissions will also be dependant on the rank they have, so lets say they send a message and their permissionlevel is 4 which is rank owner then i want to display the prefix of owner in chat

icy shadow
#

okay right

#

it would be a hell of a lot easier to just use a pre existing chat plugin and hook into that in some way

#

either through vault or papi or whatever

broken elbow
#

so you're making both a permissions plugin and a chat plugin combined.

dusky harness
#

haven't read context but why are you making a perms plugin

icy shadow
#

that is also a good point

pure crater
#

LOL true

icy shadow
#

but im sure theres a somewhat valid reason

#

maybe

merry knoll
dusky harness
#

"everything custom!!"

merry knoll
#

rather than hooking up third party stuff

#

nah, but you dont need half the stuff a plugin like luckperms provide

#

if you only need ranks

dusky harness
#

still won't hurt to have it

merry knoll
#

except that it does

icy shadow
merry knoll
#

way easier to maintain

lyric gyro
#

except that it doesn't

merry knoll
#

yes but you dont need the features

#

so thats not a plus

ebon whale
#

then just dont use them? xD

lyric gyro
#

You don't know you need something until you need it

#

And it's nice to have them there when you do

#

Rather than having to implement it yourself in your own system from scratch, potentially needing to refactor half the plugin

merry knoll
#

i would expect someone working on a custom server to at least know what they are building and will be needing

icy shadow
#

even so, what's the point?

lyric gyro
#

And Hypixel uses WorldEdit too, so they are not custom made?

icy shadow
#

what do you actually get out of spending hours rewriting something when there's a perfectly good existing solution

lyric gyro
#

Not necessarily talking about LP specifically here

icy shadow
#

i could understand if LP was really slow or something, but it's not

merry knoll
#

its more that its a solution you dont need especially in a custom setup

icy shadow
#

ok, so what? it's still much easier to use that than rewrite your own system

merry knoll
#

permissions is more of a "i will need to use third party plugins" situation

pastel umbra
#

I want the knowledge

lyric gyro
#

holy shit

#

@icy shadow

pastel umbra
#

Why are you guys even arguing

icy shadow
#

imagine not knowing

pastel umbra
#

I asked a question

broken elbow
#

Is there a way to reset commits on a repo if I've already pushed?

lyric gyro
sterile hinge
spice river
#

a simple question: random.nextint(3) is from 0-3?

icy shadow
#

iirc it's exclusive so no

spice river
#

so its 1-3?

icy shadow
#

0 to 2