#help-development

1 messages ยท Page 1867 of 1

brave sparrow
#

So it would have to compile a Map for each primitive

quaint mantle
#

its easy to understand but hard to compile

buoyant viper
#

what if u just like made ur own implementation of Map with a constructor parameter that included the fallback value

brave sparrow
#

But you still have to compile a version of map using that primitive

quaint mantle
#

like right now

#

its not possible without multiple versions

#
class IntValueMap<KT> implements Map {
    private final int def;

    public IntValueMap(int def) {
        this.def = def;
    }  
}
#
int get(KT key) {
    // get method
    if (keyNotFound) {
        return def;
    }
}
ivory sleet
#

Yeah project valhalla our lord and savior

quaint mantle
buoyant viper
#

what abt something like

class MapWithDefault<K, V> implements Map<K, V> {
  private final V def;

  public MapWithDefault(V def) {
    this.def = def;
  }

  public V get(K key) {
    if (notFound) {
      return this.def;
    }
  }
}```
quaint mantle
lavish hemlock
#

you don't need that

quaint mantle
#

thats not even related to what we're talking about

lavish hemlock
#

computeIfAbsent or putIfAbsent

#

either of those work just fine

quaint mantle
#

we're talking about maps with primitive value types

buoyant viper
#

@lavish hemlock lol

lavish hemlock
#

fastutil includes maps for each primitive type I believe

ivory sleet
#

Yeah

quaint mantle
buoyant viper
#

idk i thought u just wanted to be able to supply a default value from any type

quaint mantle
#

no..

ivory sleet
#

Primitive types cannot be passed to a generic type parameter so we as of now have to pass their boxed variants

#

However project valhalla might just change it

#

Tho there are some questions in regards to primitive generics such as nullability, erasure etc

buoyant viper
#

c# seems to have hit the nail on the head pretty well with it

ivory sleet
#

Yeah probably

lavish hemlock
#

C# also doesn't have erasure though

#

because they didn't have to care about backwards compat

ivory sleet
#

I mean one mistake in Java I believe kotlin fixed is the null safety

buoyant viper
#

backwards compatibility is just a marketing scheme ๐Ÿ˜Ž

#

out with the old in with the new

unique halo
#

I have never heard anything more stupid than what you just said

#

I hope to forget what you just said so that I never reference it again

buoyant viper
#

thats a compliment

unique halo
#

It feels like my knowledge has been impacted / warped by this opinion in a negative away

buoyant viper
#

mental torture is my specialty

young knoll
#

Iโ€™ll backwards your compatibility

golden turret
#

๐Ÿ˜Ž

young knoll
#

I think backwards compat is good, up to a point

#

Spigot got pretty extreme with it for 1.13

buoyant viper
#

forward compat is kinda interesting tbh, ur literally coding for the future

#

whereas backward compat is coding for the there and then

drowsy bramble
#

"C:\Program Files\Java\jdk-17.0.1\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\pfram\IdeaProjects\Kingdoms "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\lib\idea_rt.jar=50598:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.2.3 clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< games.kingdoms:Kingdoms >-----------------------
[INFO] Building Kingdoms 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.046 s
[INFO] Finished at: 2022-01-04T19:39:59-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Kingdoms: Could not resolve dependencies for project games.kingdoms:Kingdoms:jar:1.0.0: Failure to find org.spigotmcspigotjar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Process finished with exit code 1

buoyant viper
#

?paste for the love of god

undone axleBOT
drowsy bramble
#

i couldnt remember what it was

buoyant viper
#

dont forget it again ๐Ÿ”ช

tender shard
drowsy bramble
#

how?

#

i have buildtools already btw

tender shard
#

java -jar BuildTools.jar --rev 1.17.1 --remapped

drowsy bramble
#

i assume i add it to project structure

#

or something

tender shard
#

no, you run this command

#

?bt

undone axleBOT
drowsy bramble
#

i mean after its remapped

sullen marlin
tender shard
drowsy bramble
#

ah

young knoll
tender shard
#

1.8 didn't even have offhand, right? lol

kind hatch
#

Yep. 1.9 added that.

young knoll
#

Steve was born with one arm

#

1.9 attached a second bionic one

gleaming grove
#

i;ve just dowlaned spigot 1.18.1 to check if my plugin will work, and after running Spigot those folders have appear, can i take somehow take advantage of 'librares' folder in my plugins? or 'librares' are only for Bukkit?

tender shard
#

they are all inside spigot, you can access them at runtime

gleaming grove
#

IK but why are they now extracted to bundler folder?

sullen marlin
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

sterile token
#

Hi! how are you people?

#

I want to ask if anyone know why my command api its registering the command like double or strange

tender shard
#

isn't that simply the plugin namespace?

#

how do you register the commands?

sterile token
#

Through command map

#

Do you want the code?

tender shard
#

you use CommandMap#register, right?

#

The first parameter is the namespace, it should be your plugins name

sterile token
#

Yeah

#

Wait

#

Explain again

#

I didnt understand sorry

tender shard
#

yourCommandMap.register("yourPluginName","yourCommandName","yourCommandALias1","yourCommandAlias2", ...)

#

erm wait

#

sorry

#
    /**
     * Registers a new command
     *
     * @param permission Required permission or null
     * @param aliases    Aliases of the command. First element is the "real" command name.
     */
    public static void registerCommand(@Nullable final String permission, final String... aliases) {

        if (JeffLib.getPlugin() == null) {
            throw new JeffLibNotInitializedException();
        }

        final PluginCommand command = getCommand(aliases[0]);

        command.setAliases(Arrays.asList(aliases));
        command.setPermission(permission);

        getCommandMap().register(JeffLib.getPlugin().getDescription().getName(), command);
    }
#

e.g. here

sterile token
#

Yess

tender shard
#

the first parameter in "register" must be your plugin name

#

the second parameter must be your PluginCommand

sterile token
#

?

tender shard
#

you however use the command's name as first parameter

#

see? you use executor.getName() instead "yourPluginName"

sterile token
#

Allright

#

Thanks!

tender shard
#

np

sterile token
#

I was really confused when that happened

tender shard
#

it's made so different plugins can ahve the same command

#

/essentials:kill, /cmi:kill, /minecraft:kill etc

sterile token
#

Thats why

#

Sorry to come again but why my multi module project its looking for a custom library that made on maven repo? When its shouldnt be doing that. Because the library its installed on the local repo

wet breach
#

because you didn't tell maven to only look in the local repo

#

thus, it will search everywhere else for it and then fall back to local repo

sterile token
#

The problems is it never fall back to local

tender shard
#

then it's not in your repo

sterile token
#

Its search on maven website and explote

tender shard
#

check the exact version, artifact id and group id

#

try this:

#
mvn dependency:get -Dartifact={groupId}:{artifactId}:{version} -o -DrepoUrl=file://your/repo/path
sterile token
#

I did the following create a multi module project.

  1. My library i installed on local repo by doing "nvm install"
  2. My plugin add the library as dependency
tender shard
#

check if your library shows up when entering sth like this

sterile token
#

I went to my local repo

#

And the library its there

#

Like the poms, sha1, md5, hash

#

The library its installed correct

#

And i can import it and use it. But when do a "package execution" for converting my plugin to jar its explode. Saying that it cannot find the library on maven repo. When its installed locally like its never check on local repo

#

Someone told me trying to do an install of the main project

#

Do you agree?

#

And then to build my plugin via package execution

sterile token
tender shard
sterile token
#

mfnalex it worked

#

The problem was that i have to install the main project

#

And then compile my plugin

#

Now im getting a null pointer because i chaged what you said. But i will re run the code to check again

#

Working know

tender shard
#

what did you change? I didn't ask you to change anything D:

sterile token
#

I have found the problem

#

mfnalex not worked

#

It shown the same

#

Hum

tender shard
#

that's correct

sterile token
#

No

#

It show like extrange the commands

tender shard
#

does /coins work or do you have to enter /core:coins ?

sterile token
#

Ahh not it correct now

#

But im having an inssue that when executing from console it saying that i dont have permission

tender shard
#

Thread.sleep() ?! ๐Ÿ˜„

quaint mantle
#

idk if u meant that but i did it anyway

sterile token
#

mfnalex now when using sub command from console its saying that i dont have permissions to execute it. Any recommendation?

tender shard
sterile token
#

Allright

#

Good night!

tender shard
#

thx ๐Ÿ™‚

drowsy bramble
#

?paste

undone axleBOT
gleaming grove
#

is it possible to remove 'Enabling message' ?

tender shard
#

I don't think so

gleaming grove
#

i would like to make custom one

tender shard
#

tbh custom messages only annoy admins

#

they want to see whether it enabled or not, everything else like huge banners is just console spam

gleaming grove
#

good point

sterile token
#

This is my CommandExecutor class

drowsy bramble
#

Internal Exception: io.netty.handler.codec.DecodeException: The received string length is longer than maximum allowed (17>16)

tender shard
drowsy bramble
#

i guess label is the wrong thing to use or something?

tender shard
#

your last if statement on the screenshot

sterile token
#

Ohh yeah

tender shard
#

add a ! before "sender.hasPermission"

sterile token
#

I have just seen it

#

Thanks

tender shard
#

np

sterile token
#

My bad!

drowsy bramble
sterile token
tender shard
#

max player name length is 16 characters

sterile token
#

Why it has 16 only?

#

Like it has a reason?

tender shard
#

that's the limit mojang once set

sterile token
#

ah ok

tender shard
#

spigot could probably handle more, but the vanilla client doesn't like that

drowsy bramble
#

ah i found it

sterile token
#

Oh im again with a different problem btwww

#

Im having arguments problem now.

#

I registered an argument for the command "core"

#

And i do simple debug like this

#

And when i execute: "core info" without arguments it shown. When im not using any argument

tender shard
#

if you used /core info, that's correct though? what did you expect?

waxen plinth
#

info is the argument

sterile token
sterile token
#

But wait i pass the argument with fixArgs method, that move all the positios of the array

tender shard
#

the first message is shown when entering /core

sterile token
#

That normal

tender shard
sterile token
#

But for my argument command i use a cusotm class

#

That why

#

Like this should be

drowsy bramble
sterile token
#

Because i need to be able through executor argument, use other arguments

waxen plinth
gleaming grove
quaint mantle
#

is livingEntity.removeWhenFarAway meant to handle despawns

#

because it doesnt rn ๐Ÿ˜ญ

lavish hemlock
gleaming grove
#

yep, but i guess its more handy then default spigot command registration

quaint mantle
#

im kinda too stupid to find the answer for this myself

#

is there someone that can explain why some mobs (wandering traders) can persist NMS behaviour when leaving/deloading chunks but others cant? im trying to look through the code for it and see what makes it persist but all i see is them saving additional tags such as inventories etc

sterile token
#

Another stupid question how i can add values to 1 hashmap inside of other hashmap?

gleaming grove
#

what do you mean?

sterile token
gleaming grove
#

make a class?

waxen plinth
#

No lol

sterile token
#

I have made a hashmap with other hashmap inside

gleaming grove
#

Map<UUID,YourNewClass> cooldowns

sterile token
#

I cant because the player will contains other cooldowns

#

Like report cooldown, helpop cooldown

sterile token
sullen fulcrum
sterile token
wet breach
#

HasMap().get(HashMap().get())

sterile token
#

Oh ok

wet breach
#

probably don't have it setup correctly to make it easy to access that inner hashmap

lavish hemlock
#

cooldowns.get(uuid).get("")

gleaming grove
#

var playerHashMap = new HashMap(); this.cooldows.put(uuid,playerHashMap );

sterile token
#

But i need to save 3 values

lavish hemlock
sterile token
#

Btw

lavish hemlock
#

like Cooldown

#

and then do new Cooldown(name, duration)

sterile token
#

Uhm

wet breach
sterile token
#

Wait i think i can add a value name to Cooldown class

#

And then map<UUID, Cooldown>

#

Thanks!

wet breach
#

There you go ๐Ÿ™‚

lavish hemlock
#

y'see I don't fuckin' know your project layout so I can't really help too well but you should basically never have nested maps

sterile token
wet breach
#

with its infinite nested lists >>

lavish hemlock
wet breach
#

sure, but JSON doesn't tell you about lists or collection related things, you have to keep looping until you can't loop no moreXD

#

and JSON allows nesting to be infinite

lavish hemlock
#

that's a good thing in a way

#

allows you to store a lot of data

#

in just 1 file

gleaming grove
lavish hemlock
#

remember, JSON was meant for JS :3

quaint mantle
#

does anyone know if stopping chunks from unloading would cause any problems?

wet breach
gleaming grove
#

    public class PlayerCooldowns
    {
        private final List<Cooldown> cooldowns;

        public PlayerCooldowns()
        {
            cooldowns = new List<Cooldown>();
        }

        //to do
        public void add()
        //to do
        public void get()
        //to do
        public void remove()

    }

    public class Cooldown
    {
        private String name;
        private Consumer<Player> effect;
    }```
lavish hemlock
gleaming grove
#

maybe try this approache

sterile token
#

This was my initial cooldown class without the var and method

#

Allright thanks Jacek and you Maow

wet breach
lavish hemlock
#

XML ends lives

#

true fact don't check it

#

I am always right

gentle oriole
#

how do I put 2 maps in config?

#

defaultModules and defaultDeathMessages

wet breach
#

either serialize the map and store it that way or iterate through the map and store the information as you iterate

gentle oriole
#

serialize?

wet breach
#

wonder if we have a serial command

#

?serialize

#

nope we don't

gentle oriole
#

configFile.addDefaults((Configuration) defaultModules); works, but I soon as I try to add another map, it errors out

sterile token
#

How can i check a value on hashmap and if equals to stm return the value but all inline?

gleaming grove
#

var value = cooldowns.get(uuid); ?

sterile token
#

I now but i need to check if cooldown.getName().equals(name) and then return the object and if not null

#

All inline if it posible

wet breach
#

what do you mean all inline?

#

o.O

sterile token
#

Like doing all the code in 1 string

lavish hemlock
#

those are called one-liners

gleaming grove
#
        var playerCooldowns = cooldowns.get(uuid);
        var containsName = playerCooldowns.stream().find(c -> c.name.equalIgnoreCase(name)).find();
        if(containsName.isPresent())
        {
            var value = containsName.get();
        }
        else
        {
            
        }```
sterile token
wet breach
#

probably not going to have one, most checks are not simply one liners

#

and by technicality you can put all the code on a single line

wet breach
#

if you really want to make it hard for everyone to read ๐Ÿ˜›

sterile token
#

I need to get the the object Cooldown from my map via uuid and returning it, if the name on it equals to the one from the method

wet breach
#

public Cooldown getCooldown(UUID uuid, String name) {
    return cooldowns.get(uuid);
}
sterile token
gleaming grove
sterile token
#

I think i do it

#

With Map<UUID, Set<Coldown>

wet breach
sterile token
#

But thanks

wet breach
#

anyways I was just trying to get it to where they were wanting it lol

#

hard to follow in what is being requested

sterile token
#

public Cooldown getCooldown(UUID uuid, String name) { return this.cooldowns.get(uuid).stream().filter(cooldown -> cooldown.getName().equals(name)).findFirst().orElse(null); }

wet breach
#

if you use 3 back ticks, and then type java

gleaming grove
#

this is unsafe approache

wet breach
#

it will format it in Java style ๐Ÿ™‚

gleaming grove
#

then exceltion will be thrown

wet breach
#

it nulls

sterile token
gleaming grove
#

null.stream() ?

wet breach
#

basically what you were asking is for a lambda expression

wet breach
#

lambda's are what let you do multiple things in a line of code. I am not the best when it comes to that as I typically dislike Lambda

sterile token
#

I love lambda

gleaming grove
waxen plinth
wet breach
#

the reason I dislike them is while yes less code, it hides away details as well

waxen plinth
#

I can kinda see where you're coming from but lambdas are much more than that

sterile token
#

I cannot

#

Another problem

#

Omg

wet breach
sterile token
wet breach
#

therefore, lambda is not special I will code in a way where details are not automatically hidden from view ๐Ÿ™‚

#

however that doesn't mean others need to stop using lambda

#

just lambda doesn't mean it executes less ๐Ÿ˜›

waxen plinth
#

They're never strictly needed

#

You can always use anonymous class definition

#

Or define an entire class

wet breach
waxen plinth
#

But they really cut down on boilerplate

#

It's the main use case where lambdas are the clear solution

sterile token
# sterile token

Any ideas this happens when i solve the problem return problem

gleaming grove
#

@sterile token you are trying to put wrong object

#
            {
                if(!cooldowns.contains(uuid))
                {
                    cooldowns.put(uuid,new Set<CoolDown>());
                }
                var set = cooldowns.get(uuid);
                set.add(new CoolDown());
            }```
waxen plinth
#

You're trying to put a Cooldown where it needs a Set

#

Best way to do it:

lavish hemlock
gleaming grove
#

the value is Set not Cooldown

sterile token
#

Oh okk

waxen plinth
#
this.cooldowns.computeIfAbsent(uuid, k -> new HashSet<>()).add(new Cooldown(name, duration));```
#

I love computeIfAbsent

#

It's so great

sterile token
#

What does it?

sterile token
gleaming grove
waxen plinth
sterile token
#

Wait no i have a doubt what it the best solution? A MultiMap? Map + Set? Map + Map?

lavish hemlock
#

doubt*?

#

anyway uh

sterile token
#

yeah

lavish hemlock
#

Multimap is specialized for this purpose

#

but it's also dependent on Guava

#

I'd recommend it personally out of cleanliness

wet breach
lavish hemlock
#

well you shouldn't use HashMap as the type

#

just the implementation

#

also, beginners have a tendency to overcomplicate just let him do it

waxen plinth
#

I avoid multimap

wet breach
#

give me a sec, think I have example code for how to use maps inside maps easily

sterile token
gleaming grove
lavish hemlock
#

You mean the functional type or a design pattern?

gleaming grove
#

both ๐Ÿ˜„

waxen plinth
#

๐Ÿค”

sterile token
lavish hemlock
#

the menu closet

#

inside you will find many dastardly things

#

like bad UI design

sterile token
lavish hemlock
#

and people who use Electron

wet breach
#

well I can't find a piece of code specifically but you are free to browse through yourself and see if anything might be helpful

#

best thing of that project is it displays how conversation API can be used though ๐Ÿ˜›

sterile token
#

Allright thanks really thanks

urban bramble
#

What's the deal with the depreciation in the Chunk Generator? It means that you can't return custom chunk data

sterile token
#

I will pin your message

wet breach
lavish hemlock
#

deprecation = "shouldn't use," not "can't use"

wet breach
#

exactly

urban bramble
lavish hemlock
#

unless explicitly stated otherwise

gleaming grove
#

@lavish hemlock well when it comes to GUI do you know some architecture papers how to implement varable tracking (Binding) to make responsive GUI?

urban bramble
#

I'm asking why, I know that I can use it (since I do use it)

lavish hemlock
#

uhh well I don't know papers

#

I don't really look at research docs

#

mainly bc they fly over my head

#

but honestly just implement the observer pattern

wet breach
# urban bramble Right, why shouldn't we use it?

not sure, usually there is a message of some kind attached to things deprecated it could also mean that something better is being created and thus it is to raise awareness that it might change soon

lavish hemlock
#

works fine

lavish hemlock
#

JavaFX uses observable properties pretty much everywhere

urban bramble
#

It was added when all those other methods were added

lavish hemlock
#

oh yeah also observable collections too, those are cool

urban bramble
#

Even though it's not a replacement

lavish hemlock
#

would actually recommend a reactive programming lib like RxJava

gleaming grove
waxen plinth
#

I believe only the old style chunk generator method is deprecated

#

There is a new one you should be using

lavish hemlock
#

changes should immediately propagate

urban bramble
#

Only using the provided features

lavish hemlock
#

which is why event listeners (observers) should be used

waxen plinth
urban bramble
#

There's no way to return custom ChunkData

gleaming grove
#

yes but in case TitleName varable change i need to refresh whole GUI

lavish hemlock
urban bramble
#

Only modify the existing

waxen plinth
#

In what case would you need to

lavish hemlock
#

when the program must repeatedly check for the change of something as opposed to that change informing the program

#

I design my stuff to never have polling

#

I prefer reactive design

waxen plinth
#

Same

gleaming grove
lavish hemlock
#

I find it easier to visualize tbh :p

#

and in the end it's faster and cleaner

gleaming grove
#

i have implement it like this for "buttons"

urban bramble
quaint mantle
#

for NMS entities that despawn do people just re-spawn them on chunk load

sharp bough
gleaming grove
#

The tracking Value in this case is Boolean. This is example of switch on/off Button on GUI

sharp bough
#

ah

#

looks interesting

wet breach
#

you don't need to, just more or less poking some fun at those who optimize to the extreme however what I said is true regardless ๐Ÿ˜›

gleaming grove
#

i think there is no difference becouse i would need to use 'Byte' as a class instead of primitive type 'byte'

#

and Byte and Boolean take the same amount of memory i guess

wet breach
#

just ranges

#

but it has to do with more then that however

gleaming grove
#

but why short is better then booleans?

wet breach
#

because boolean has to check for false and true and not just 1 or 0. As I said, technically true what I said but its a micro optimization thing lmao

#

as I said was more in reference to those who love to optimize to the extreme XD

gleaming grove
#

interesting i thought boolean is somehow transorm to 0/1 after code compilation

wet breach
#

memory wise using a boolean or int will probably take up the same amount

gleaming grove
wet breach
# gleaming grove

the only thing that is known about boolean for the JVM is that at minimum it can only take up 1 bit

gleaming grove
#

google says that boolean is even smaller then byte

wet breach
#

google isn't the one that wrote the docs either

#

implementation wise if I recall, boolean is backed by an int

#

also in the implementation or JVM, boolean doesn't have a specific size it must be and this is actually true for all of the primitives because they are all OS dependent

#

as well as JVM dependent

#

therefore, boolean could take up more space memory wise but that wasn't what I said in why boolean is less optimal

gleaming grove
#

ok, good to know

dreamy dove
#

Does anyone have something like a Resourcepack converter for diffrent versions? Because we want to send a different Resourcepack version depending on the Player Client version. Also I m searching for a Ressourcepack compressor that make the textures and .jsons smaller

gentle oriole
#

How do I get ENABLED_MODULES as Map in config??

config.yml

ENABLED_MODULES:
  PLAYER_OBTAINED_OP_ITEMS: false
  PLAYER_RANDOM_ON_STONE: true
  PLAYER_RANDOM_ON_GRASS: true
DEATH_MESSAGES:
  PLAYER_OBTAINED_OP_ITEMS: got too powerful
  PLAYER_RANDOM_ON_STONE: stepped on poison stone
  PLAYER_RANDOM_ON_GRASS: stepped on poison grass
sudden reef
#

uh, hello

#

Why when using this method

#

Bukkit.getServer().broadcast(message, permission);

#

The console won't receive it.

#

But when using

#

Bukkit.getServer().broadcastMessage(message);

#

The console will receive it.

#

At first i thought that it was bc the permission wasn't registered in plugin.yml but after that i added it and still the same

sullen marlin
#

does the permission have a default that includes the console

#

(true or op)

sudden reef
#

aaaaaaaagh

#

my bad

#

i put not op

#

the first thing that came to my mind

#

weird

#

Still not working

#
Broadcasts the specified message to every user with the given permission name.
Params:
message โ€“ message to broadcast
permission โ€“ the required permission permissibles must have to receive the broadcast
Returns:
number of message recipients
#

i don't think it includes the console

#

i can just add one to the console, not really a problem

sudden reef
gentle oriole
#

How do I change type of Map to type of Map<String, Boolean>? It forces me to remove <String, Boolean> on enabledModules enabledModules = configFile.getObject("ENABLED_MODULES", Map.class);

quaint mantle
#

anyone know why

#

PlayerInteractEntityEvent is called twice

#

nvm its the hand issue

sudden reef
#

hey

#

I can't setScore

#
Scoreboard sb = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
if (sb.getObjective("output") == null) {
  sb.registerNewObjective("output", "dummy", "output");
}

Objective obj = sb.getObjective("output");
int num;

Score score = obj.getScore("save-all");
num = score.getScore();
score.setScore(3);
#

The score wont change to 3.

gentle oriole
#

gosh does no one work here?

gleaming grove
#
if (board.getObjective("output") == null) {
  board.registerNewObjective("output", "dummy", "output");
}

Objective obj = board.getObjective("output");
int num;

Score score = obj.getScore("save-all");
num = score.getScore();
score.setScore(3);
for(var player:Bukkit.getOnlinePlayer())
{
player.setScoreboard(board);
}
#

maybe try like this

sudden reef
#

i'll try

#

wait but

#

The player is not real

gleaming grove
#

what do you mean?

#

not real?

#

in this example all online player will have updated scoreBoard

#

i guess you just replace Bukkit.getOnlinePlayer() with player you want scoreboard be updated

sudden reef
#

Oh ok

gentle oriole
#

Hey, how do I surpress Unchecked assignment: 'java.util.Map' to 'java.util.Map<java.lang.String,java.lang.Boolean>' warning? my code works finee.

static Map<String, Boolean> enabledModules = new HashMap<>();
enabledModules = configFile.getObject("ENABLED_MODULES", Map.class);
gleaming grove
#

try this

gentle oriole
#

wait. getClass() is a thing? Thanks!

gleaming grove
#

i believe so

gentle oriole
#

warning

sudden reef
#

shit

gleaming grove
#

so you can just ignore it?

gentle oriole
#

I don't know how to ignore it

#

but code works perfectly fine

gentle oriole
gleaming grove
#

warnings mainly says '"your code is unclear do some changes'

#

nope enabledModules.getClass() return HashMap<String,Boolen>

#

try it enabledModules.getClass().getName()

gentle oriole
gentle oriole
gleaming grove
#

the content of the string

muted sand
#

~~How can I see if a player is using the /msg command, and cancel it if they are
I did

    @EventHandler
    public void preCommand(PlayerCommandPreprocessEvent event) {
        Player player = event.getPlayer();
        if (event.getMessage().equalsIgnoreCase("/msg")) {
            player.sendMessage("no");
        }
    }

And that works, but if I do something like /msg haappi hi, it doesn't send me "no"

wait do i split this so i only get the first part~~
got itt

glossy scroll
#

running into a really odd java issue:

            ArrayList<Vector> availableDoors = new ArrayList<>(this.availableDoors.keySet());
            Vector newDoor = availableDoors.get(random.nextInt(availableDoors.size()));
            currentFace = this.availableDoors.get(newDoor);
            System.out.println(this.availableDoors);
            System.out.println("Chose " + newDoor + ", " + currentFace);
            this.availableDoors.remove(newDoor);```
gets me 
```[00:14:01] [Server thread/INFO]: Available doors: [-32.0,0.0,68.0, -7.0,0.0,63.0, -25.0,0.0,33.0]
[00:14:01] [Server thread/INFO]: {-32.0,0.0,68.0=SOUTH, -7.0,0.0,63.0=SOUTH, -25.0,0.0,33.0=NORTH}
[00:14:01] [Server thread/INFO]: Chose -7.0,0.0,63.0, null``` in console. For some reason the `newDoor` instance isnt able to be referenced from the map?
gleaming grove
sudden reef
#

What i'm saying is that

#

after doing setScore(3)

#

And then running getScore, it's still 0.

#

/scoreboard players get save-all = 0

#

not the sidebar

gleaming grove
#

ik i think you need to update whole scoreboard somehow

glossy scroll
sudden reef
#

idk for now i will use dispatchcommand

#

I'll figure out later

gleaming grove
#

@gentle oriole what is the class of configFile varable/

sudden reef
#

afterall i'm already sending "execute store success score save-all output run save-all" to console

gleaming grove
#

is it Spigot class?

gentle oriole
#

normal class

gleaming grove
#

static Map<String, Boolean> enabledModules = new HashMap<>();
enabledModules = configFile.getObject<Map<String, Boolean>>("ENABLED_MODULES", Map.class);

#

try to this

#

maybe warning disappear

#

or just configFile.getObject<Map>("ENABLED_MODULES", Map.class);

sudden reef
#

ooooooooooooooooooo

#

ok it's still not working even with dispatch command

#

so my sb is outdated

#

i think i have to update it constantly

gleaming grove
#

@gentle oriole do you use Intelij IDE?

sudden reef
#

bc in my code it's not updating

gleaming grove
#

so hold CTRL and click on the configFile.getObject getObject method

#

and send me how it looks inside

gentle oriole
gleaming grove
#

with Screen shoot or copy and paste code

dark arrow
#

how to set title screen for players?

gentle oriole
dark arrow
gentle oriole
dark arrow
#

the big welcome that comes on their screen when they enter the server

gleaming grove
#

@gentle oriole do you have this warning?

dark arrow
#

thanks

gleaming grove
#

idk you can just ignore this warning

#

warning only means that your code is Unclear in some place, nothing more

sudden reef
#

Oh my god

#

ok no fuck this, i'll do it tomorrow

wet breach
gentle oriole
wet breach
#

oh there is probably a setting to not have the IDE warn you of it

#

not sure where it is in IntelliJ. I use netbeans ๐Ÿ™‚

buoyant viper
#

cant u just slap a SuppressWarnings on there

#

not that id recommend it but

wet breach
#

that is for so you don't get the warning in the compiler logs

buoyant viper
#

it can also make the ide shut up abt stuff

gentle oriole
#

im the type of person who dont like to leave unread messages, uncleared notifications, unfixed warnings...

#

btw is there somthing that can organize config.yml alphabetically? smh if I make changes to it ingame, the order of it changes so that the modified value is in the bottom.

buoyant viper
#

disabling join/quit messages should be as simple as calling event.setJoinMessage/setQuitMessage("") right?

sacred mountain
#

whats the spigot thread to hire a dev

buoyant viper
#

?services maybe?

undone axleBOT
buoyant viper
#

oh i use null to disable it, ok

quaint mantle
#

when will this thing end huh

buoyant viper
#

ResourceLocation... u workin with server internals rn?

quaint mantle
#

well not?

#

im lookin at the src

#

not working with it

analog prairie
#

Can I download the latest version of the plugin, then disable and enable to update the plugin?

#

But when the server is running, will the plugin folder be locked?

sullen marlin
#

Only on windows

#

You can put it in a folder called update (updates?) and it will be copied next restart

kindred valley
#

How can i control inventory closimng

#

like if(player.closeInventory == true){

alpine urchin
gentle oriole
#

how do I get config as HashMap?
enabledModules = configFile.getObject("ENABLED_MODULES", HashMap.class);
Works but, it returns DEFAULT VALUES

#
        System.out.println(enabledModules);
        enabledModules = configFile.getObject("ENABLED_MODULES", HashMap.class);
        System.out.println(enabledModules);

config.yml is empty...

alpine urchin
#

its 0kb

kindred valley
quaint mantle
#

?learnjava

undone axleBOT
rough basin
#

is it legit?

vale ember
#

wdym legit? also you may remove toString call

gentle oriole
blazing scarab
quaint mantle
#

is there a resource on how to do fireworks in spigot

analog prairie
sullen marlin
#

@analog prairie yes, I think it should have the same name as the one itโ€™s updating

analog prairie
eternal oxide
#

not reliably

analog prairie
rocky glacier
#

ayo where's the night and day sky located in the texture files

dark arrow
#

How to use Particle data type?

eternal oxide
#

What do you mean how to use it?

#

In the spawn method pass the data

dark arrow
#

Particle particle = ?

eternal oxide
#

dataType is T a Class

dark arrow
#

In PlayerJoinEvent i want to use

rough basin
#

Can someone explain the reason why?

#

it's _p, but it's not working

quaint mantle
#

Donโ€™t compare strings with ==

#

Use .equals

still wing
#

I don't really understand about plugins, but you can help me with 2 classes and how can I create main in a plugin.yml

wet breach
dark arrow
#

is it possible to create your own achivements?

rocky glacier
quaint mantle
#

hey guys, is there a way i can naturally generate a flat world with no hills/massive caves like old MC terrain

wet breach
#

if you want flat world just set the level-type in server.properties to flat

quaint mantle
north trench
#

how do i do it?

pseudo moth
#

Hey, I'm trying to use specialsource to remap my plugin, however, when I run it via maven, I get this error: ```
The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.3:remap are missing or invalid

Here's what I'm running for the plugin: https://paste.md-5.net/cequvivuwa.xml
north trench
#

how to make lightnig when right click air spigot coding?

digital rain
#

you listen for the playerintercatevent, and then you just get the position of the block he is looking at and summon a lightning

north trench
#

example?

digital rain
#

what example?

#

you mean like you want some code?

north trench
#

ye

digital rain
#

you can just adjust the code to your demands

pseudo moth
#

Anyone got a solution for this?

north trench
tender shard
#

I can't get it to work
is not a valid error description

#

We need a command for that like
?showerror

"It is not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what does actually happen. If you get ANY error console errors, also ?paste the FULL stacktrace.

tender shard
#

because 50% of my messages here is asking people what exactly their problem is and they only say "I get NPE" or "it doesn't work" lol

chrome beacon
#

+1

quaint mantle
#

``` `[12:48:52] io.netty.handler.codec.EncoderException: io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 520093703, max: 536870912)

[12:48:52] at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:816)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:723)

[12:48:52] at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:816)

[12:48:52] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:723)

tender shard
#

or

#

are you sending a plugin message?

#

if so it's too long

digital rain
north trench
#

example?

digital rain
#

urghh

#

your first time making plugins?

north trench
tender shard
# north trench example?
    @EventHandler
    public void onLightning(PlayerInteractAtEntityEvent event) {
        Location location = event.getRightClicked().getLocation();
        location.getWorld().strikeLightning(location);
    }
digital rain
#

well i was just about to put in here, but thanks anyways lol

tender shard
#

๐Ÿ˜„

digital rain
#

not sure whether PlayerInteractAtEntityEvent or PlayerInteractEntityEvent tho

tender shard
#

what I sent is correct, I wrote it in intellij

digital rain
#

yes, i very much agree

#

but those two things are two differen event listeners

quaint mantle
#

?learnjava

undone axleBOT
north trench
#

how do i do that?

tender shard
north trench
#

example?

tender shard
#

?jd

tender shard
#

check Player there

digital rain
#

and maybe check bit of yt vids about spigot coding, they can be quite educational for starters as well

north trench
digital rain
#

they're usually very generic right, but simple concepts like event listeners, command listeners can be easily learned that way as well

#

everything else then is just combination of java and spigot from there

toxic plaza
#

Hello, i've recently updated my plugin to 1.18, everything seems to be fine accept any use of ChatColor / ChatMessageType / TextComponent are not working, could someone help me resolve this issue?

digital rain
#

yes

#

wait a sec

#

you need to import bungeecord-chat-1.16-R0.4.jar

toxic plaza
#

ok ill give that a go, thanks

digital rain
#

i mean import into the libraries

quaint mantle
#

how to check if a username has played before

#

not a Player

toxic plaza
digital rain
#

did you use buildtools to create the spigot jar file?

ivory sleet
digital rain
#

okay and then you decompiled it right, and extracted the spigot.snashot.1.18.1 file right?

analog prairie
#

How to get a server id?

quaint mantle
digital rain
# toxic plaza yeap

so in the same folder the meta-inf folder you can find the bungeecord-chat-1.16-R0.4.jar

granite quarry
#

I am trying to make a simple plugin I am using eclipse when I hover over JavaPlugin it does not lets me import

ornate heart
granite quarry
digital rain
#

META-INF/libraries to be exact

granite quarry
#

create a class called 'JavaPlugin' or fix project setup

analog prairie
#

How to get a server id?

granite quarry
#

nvm

analog prairie
granite quarry
toxic plaza
digital rain
analog prairie
#

Like Geyser Server UUID

granite quarry
#

oh

ornate heart
granite quarry
toxic plaza
# digital rain .

i cant see that... :3 i have spigot, craftbukkit, work, apache maven 360 builddata bukkit and portiblegit... those are the folders i got..

digital rain
#

oh well idk then, you can either search for it, decompile another spigot jar, or if you trust me i can send the file into your dms

toxic plaza
#

please XD

granite quarry
ornate heart
granite quarry
#

ok

ornate heart
#

?bt

undone axleBOT
granite quarry
#

thanks

tardy delta
#

why should i do db queries sync on enable or disable?

#

because it cant lag the server?

opal juniper
#

so the server doesnt load/shutdown until they are finished

tardy delta
#

ah in that way i get it

granite quarry
# ornate heart ?bt

the build tools.jar? I download it now its installing something in a very old type insaller

tardy delta
#

and if i do it async the query would be interruped

granite quarry
#

it made 3 folders work, portalble git and Bukkit

ornate heart
granite quarry
#

there is git bash and git cmd

#

and other folders and text files

ivory sleet
tardy delta
#

uhh that sounds too complicated

#

๐Ÿ˜„

ornate heart
# granite quarry there is git bash and git cmd

Actually I lied. I donโ€™t even think you need Git Bash to run buildtools. Open terminal in the same directory as your BuildTools.jar and then run the command

java -jar BuildTools.jar --rev latest

granite quarry
#

ok

#

umm actually 1 more thing is about storage I am concerned about that

lavish hemlock
#

the BuildTools result is like multiple gigabytes :3 you'll be fine :3

quaint mantle
#

is there anyway to fully change a player's name ?

#

like from gameprofile or whatever

granite quarry
ornate heart
#

Youโ€™re going to have to clear some space then

granite quarry
#

oh can I drag the files to a different directory?

tardy delta
granite quarry
#

its at Starting clone of htts://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git to CraftBukkit

#

since 2 minutes

ornate heart
granite quarry
#

will it take more then 1 gb?

#

that's my question

rough basin
#

I set the arrow's damage to 10, but it kills player only one shot

#

What is it?

young knoll
#

Damage is also based on velocity

rough basin
#

ohh

#

Thanks

granite quarry
#

wait I got a error

#

`Attempting to build version: 'latest' use --rev <version> to override
Found version
{
"name": "3395",
"description": "Jenkins build 3395",
"refs": {
"BuildData": "f31eb04b918592f66c6edd17c9b5998383581ae5",
"Bukkit": "a7505b3cd0498baca152777767f0e4ddebbe4d1a",
"CraftBukkit": "cc86ab1886c9d2d50495711288ffad33a0c7e554",
"Spigot": "f4ff00ffa451bd116cfbab3bd9d83b42e93904dd"
},
"toolsVersion": 138,
"javaVersions": [61, 61]
}

Pulling updates for C:\Users\User\Videos\Minecraft\BuildData.git
*** Warning, could not find origin/master ref, but continuing anyway.
*** If further errors occur please delete C:\Users\User\Videos\Minecraft\BuildData and retry.`

#

I closed the terminal accidently f

#

leave it

pseudo moth
vale ember
#

anyone how, how in intellij, i can change every local variable declaration to var, and make them final, in exisiting project?

tardy delta
#

does this looks good?

#

without the put twice then

ivory sleet
#

looks very coupled

#

and why the 0?

tardy delta
#

idk i had like three getUser methods before

ivory sleet
#

pretty sure you could come up with a slightly more expressive name

#

also fourteenbrush

#

you probably want to use your own work stealing thread pool

#

instead of the common pool / cf's own expensive executor

tardy delta
#

if i knew how those things work i could use it

ivory sleet
#

do you know how threads work?

tardy delta
#

yes

ivory sleet
#

well in Java the class Thread is a special class as you're very much aware of (since invoking Thread::start won't run the runnable in sync with your other code you've declared

#

a thread pool is an object which manages a bunch of threads basically (their lifetime, creation and destruction)

grand coral
#

How to Block to place blocks on Grass and tall Grass?

tardy delta
#

uhu

#

but why using multiple?

#

for db call

ivory sleet
#

well what if you're querying all the ranks from the database and all the users

tardy delta
#

i'm not but yea

ivory sleet
#

if its on a single thread you'd only be able to do one of those things at the time

#

however thing is

#

any call to an io device is expensive in terms of resources and takes much longer than other operations such as normal method calls etc

#

your database is probably an io device

#

therefore

tardy delta
#

i use a hikari datasource

ivory sleet
#

when you use CompletableFuture#runAsync(callback) you actually invoke this instead CompletableFuture::runAsync(callback,ForkJoinPool.commonPool())

#

which as you can tell uses the common pool

#

and thing is, you'll now be using the threads from the common pool which will block other operations done in the fork join pool such as parallel streams

#

which isnt usually good

#

(since those db calls probably are quite resource expensive and take greater amount of time in comparison to what the common pool is prepared for)

ivory sleet
tardy delta
#

and whats the difference between the common pool and for example Executors.newCachedThreadPool?

ivory sleet
#

a cached thread pool may reuse a its threads

#

the common pool is an instance of ForkJoinPool

#

which goes under the name work stealing pool

#

and the main difference is that the work stealing pool can steal work

#

well, what I mean is that lets say you have 2 workers

#

and you delegate 10 tasks to the first worker

#

now the second worker might steal 5 of those tasks if they dont have any tasks themselves

tardy delta
#

uhu

ivory sleet
#

so its ideal when you have a large task which can be split up into smaller tasks

#

for instance large computations

#

not so ideal for file and db writes/reads

#

but well it can work decently

tardy delta
ivory sleet
#

hmm well not easily

tardy delta
#

right

ivory sleet
#

in principle you could split them up however that'd require some sort of locking mechanisms so you dont run into a concurrency update problem

#

or well not the db query

#

but for instance when you do stuff with a file before writing to the disk

#

or smtng

sick portal
#

Hello, is there a rapid way to call night skip ? I want the night to skip if 1/3 of online players are sleeping.

@EventHandler
    public void onPlayerBedEnter(PlayerBedEnterEvent event) {
        // Increment the number of players sleeping
        sleepingPlayers.incrementAndGet();

        // Check if the number of players is equal at 1/3 of the total online players
        int onlinePlayers = Bukkit.getOnlinePlayers().size();
        if (sleepingPlayers.get() >= (onlinePlayers / 3)) {
            // Sleep
            // ??
        }
    }
ivory sleet
#

anyways point is, the common pool is mainly present for parallel streams and other tasks which can be decomposed into smaller tasks

tardy delta
#

ah i get it

ivory sleet
#

by submitting potentially big tasks you decrease the efficiency of all other parties which might use the common pool

#

so usually I just have my own work stealing pool

buoyant viper
#

i forget the name

ivory sleet
#

in my most recent app I just this implementation

new ForkJoinPool(
                Runtime.getRuntime().availableProcessors() * 2,
                ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                (t, e) -> e.printStackTrace(),
                false
        );
sick portal
buoyant viper
#

no

#

its like sleepingPercentage or something like that

sick portal
#

playersSleepingPercentage

#

So i need to set this at 33% ?

buoyant viper
#

yeah u set it to like 0.33 or 33 i think

#

i forget how it scales

#

33

#

0 to 100

#

it is for 1.17+ tho so idk then if ur working with something lower than that

solid cargo
#

does this get caused:
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getDisplayName()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is null
if what happens? if the displayname is null (i.e hand?)

sick portal
misty current
buoyant viper
misty current
#

or if it's null of ofc

sick portal
#

or do i apply it to the world ?

misty current
#

can't you set gamerules with the api instead of doing it this way?

young knoll
#

yes

misty current
#

iirc u can with the world class

solid cargo
#

this should fix it?

else if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase("ยง2Sellwand") && !e.getPlayer().getInventory().getItemInMainHand().equals(new ItemStack(Material.AIR))) {```
too lazy to start up my localhost
misty current
#

world.setGameRule(GameRule, Object);

#

yes indeed

solid cargo
#

or should i return it in the event start?

misty current
#

if(item == null || !item.hasItemMeta()) return;

woeful crescent
#

comparing to Material.AIR could produce a nullpointerexception

young knoll
#

hasItemMeta

misty current
#

cant format because alt codes broken on my keyboard

#

sad

sick portal
buoyant viper
#

np

misty current
#

np

solid cargo
#

like this?

misty current
#

i'm not sure if it can return null or it just returns an air itemstack

tardy delta
misty current
#

you should also check if the item in main hand is null

solid cargo
#

idk i think this should be enough

tardy delta
#

.getType()

misty current
#

gimme a sec

tardy delta
#

not .equals

solid cargo
misty current
#
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
if(item == null || !item.hasItemMeta()) return;
olive lance
#

Bruh lmao

tardy delta
#

check if the item == null || the type == Air

#

then return

olive lance
#

I am not naming any sites but already found a thread up asking for my plugin leak and it has like 4 downloads ๐Ÿ˜ญ

solid cargo
#

item== null always returrns null tho

#

i mean

#

false

solid cargo
#

yeah

misty current
#

just check for meta then

buoyant viper
#

๐Ÿ˜”

olive lance
#

They said you leaked it yourself?

buoyant viper
#

no they said i made the resource they leaked

olive lance
#

Oh

buoyant viper
#

but i had nothing to do with what they posted

olive lance
#

Weird lol

buoyant viper
#

i think i had a similar name to the actual dev or something

olive lance
#

I made an account and replied to the guy acting like some big time leaker I was like yeah bro not gonna waste my time on this

ivory sleet
#

lol pulling the no u card

north trench
tardy delta
#

also i was wondering if i should just load an user object to the cache from the database (async), wait until its there and return it?

ivory sleet
#

idk

#

I usually dissociate the data model and the persistence system entirely

red sedge
#

how can I push the player forwards?
I think adding velocity in the direction of player would work but idk hwo to get the player's direction & convert that to vector

tardy delta
#

is this something?
return forkJoinPool.submit(() -> getUserFromDatabase(uuid)).join();

ivory sleet
#

well

#

just

olive lance
#

If you comprise your plugin name of only 4 letters or less words then that site refuses to search for those โ€œtoo-smallโ€ words

spiral light
#

just another ghost ping at me here O.o

worn tundra
red sedge
ivory sleet
#
CompletableFuture.runAsync(() -> {
  try {
    return database.fetch(id);
  } catch (Something e) {
    throw new CompletionException(e);
  }
},forkJoinPool);
tender shard
worn tundra
ivory sleet
#

btw @tender shard

#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

ivory sleet
#

changed it little but yeah

tender shard
red sedge
tender shard
#

or did you add it today?

ivory sleet
#

๐Ÿ˜›

#

rn

tender shard
#

perfect :3

#

thx

ivory sleet
#

thx for contributing

worn tundra
tardy delta
#

and this? ๐Ÿฅบ

#

i think that return will cause problems, ah yes it will return null

red sedge
vale ember
#

is there a way to accept itemstack array in annotation?

tardy delta
#

create a custom anootation?

ivory sleet
#

fourteen

tardy delta
#

im bad at this stuff i know

vale ember
#

it says it is not valid member

ivory sleet
#

let me write an example of how you might wanna handle a data model if you're fine with that?

tardy delta
#

sure

red sedge
buoyant viper
north trench
#

can someone help me

red sedge
#

maybe tell us what you need help with?

north trench
#

ok

north trench
glossy venture
red sedge
#

just check if the player's held item is your item

north trench
red sedge
#

if?

glossy venture
#

As annotations are initially processed at compile time

vale ember
vale ember
glossy venture
#

But then you cant use it as an annotation i think

north trench
tender shard
#

?learnjava

red sedge
undone axleBOT
red sedge
#

also conclure wtf are you writing

tender shard
#

a novel

buoyant viper
#

a novel

north trench
#

lol

buoyant viper
#

i

solid cargo
#

i cant seem to be able to get contents of a dropper

ivory sleet
#
class User {
  final UUID id;
  volatile String username;
  volatile int points;

  User(UUID id) {
    this.id = id;
  }
  //constructos, getters and setters and yadayadayada
}

@FunctionalInterface interface UserFactory {
  User newUser(UUID id);
}

class UserRepository implements Iterable<User> {
  final Map<UUID,User> map;
  final UserFactory factory;

  UserRepository(Map<UUID,User> map, UserFactory factory) {
    this.map = map;
    this.factory = factory;
  }

  public User getOrCreate(UUID id) {
    return this.map.computeIfAbsent(id,factory::newUser);
  }

  public Optional<User> getIfPresent(UUID id) {
    return Optional.ofNullable(this.map.get(id));
  }

  public Iterator<User> iterator() {
    return this.map.values().iterator();
  }
}

interface HumbleStorage<D> {
  void bootUp();

  void shutdown();
 
  void load(D data);

  void save(D data);
}

class DelegatingStorage<D> {
  final HumbleStorage<D> storage;
  final Executor executor;

  DelegatingStorage(HumbleStorage<D> storage, Executor executor) {
    this.storage = storage;
    this.executor = executor;
  }

  void bootUp() {
    this.storage.bootUp();
  }

  void shutdown() {
    this.storage.shutdown();
  }

  CompletableFuture<Void> load(D data) {
    return CompletableFuture.runAsync(() -> {
      this.storage.load(data);
    },executor);
  }

  CompletableFuture<Void> save(D data) {
    return CompletableFuture.runAsync(() -> {
      this.storage.save(data);
    },executor);
  }
}

class MySqlHumbleUserStorage implements HumbleStorage<User> {
  public void load(D data) {
    //TODO implement
  }

  public void save(D data) {
    //TODO implement
  }
}

class PluginDerivative extends JavaPlugin {
  DelegatingStorage<User> userStorage;
  UserRepository userRepo;

  void onEnable() {
    int parallelism = Runtime.getRuntime().availableProcessors() * 2;
    Executor executor = new ForkJoinPool(
      parallelism,
      ForkJoinPool.defaultForkJoinWorkerThreadFactory,
      (t, e) -> e.printStackTrace(),
      false
    );
    this.userRepo = new UserRepository(new ConcurrentHashMap<>(16,0.25f,parallelism),User::new);
    this.userStorage = new DelegatingStorage<>(new MySqlHumbleUserStorage(),executor);
    this.userStorage.bootUp();:

    this.getServer().getOnlinePlayers().forEach(player -> {  //load all players in case of a reload
      User user = this.userRepo.getOrMake(player.getUniqueId());
      this.userStorage.load(user).join();
    });
  }
}

@tardy delta sth like this

solid cargo
#

currently the way im getting inventory is

Dropper d = (Dropper) e.getClickedBlock();

and then

Inventory inv = d.getInventory();

and then i get the needed materials blah blah blah

ivory sleet
#

now you probably want to call the shutdown() method in onDisable

red sedge
ivory sleet
#

I did lol

tender shard
red sedge
#

okay wow... thats a flex

tender shard
#

You must get the block's state and cast that

ivory sleet
north trench
#

?

quaint mantle
red sedge
solid cargo
#

c means dropper btw.
like this?

glossy venture
#

I think that retention doesnt matter for compile time

quaint mantle
#

idk

#

like, 50/50

glossy venture
#

I think it is always processed at compile time

quaint mantle
#

annotations works as documentation aswell

ivory sleet
#

yeah they're always there at compile time in principle given that the annot is defined on the compile classpath

quaint mantle
#

or at compile-time codegen

#

nvm im dumb

glossy venture
#

It is always processed at compile time, and it can be at runtime with the correct retention

quaint mantle
#

yep

tardy delta
#

all those classes

ivory sleet
#

yeah well usually you want some sort of cleaner/invalidation manager/housekeeper (as well)

#

so you have an object which is responsible for clean up and one for the caching and one for the actual persistence

vale ember
#

if i have Class<? extends Event> and i want to register handler for that event, how would i do that?

ivory sleet
#

PluginManager::registerEvent exists

#

tho you need to pass down a listener and event executor as well

ivory sleet
vale ember
#

in listener, how would i declare method? i only have Class<? extends Event>, i don't know which event it is

ivory sleet
#

rly depends on what exactly you're trying to achieve here

vale ember
#

suppose i have a Consumer<? extends Event> and Class<? extends Event> and i want that consumer to be called each time that event happen, with that event as argument

ivory sleet
#

oh

#
interface EventHandler<E extends Event> extends Listener, EventExecutor {
  void invoke(E event);

  default void execute(Event event, Listener listener) {
    this.invoke((E)event);    
  }

  static <E extends Event> void register(Plugin plugin, Class<E> eventType, Consumer<? super E> handler) {
    EventHandler<E> handler = event -> handler.accept(event);
    plugin.getServer().getPluginManager().registerEvent(eventType,handler,NORMAL,handler,plugin);
  }
}```
Maybe you're looking for something like this?
pulsar path
#

whats the default falling velocity of an minecart if you dont set any

vale ember
#

yeah, probably that is what i want, thanks

north trench
north trench
mellow comet
#

Is it possible to set the default Bungee Server whit a plugin?

mellow edge
#

why is team.getPlayers deprecated?

eternal oxide
#

not all members have to be players

mellow edge
#

how can I get all the player in a team