#help-development

1 messages Ā· Page 1479 of 1

quaint mantle
#

try to use try & catch

#

trace the error

chrome beacon
#

He says it doesn't throw any (Which it should)

slim kernel
#

yeah there is no error in the console

ornate heart
#

So it spawns the gravel ?

slim kernel
#

yes

eternal oxide
#

You can;t cast a Block to a FallingBlock

quaint mantle
#

FallingBlock fallingBlock = (FallingBlock) spawnLoc.getBlock();

#

this line

#

remove it

ornate heart
#

How is your console not throwing an error šŸ¤”

eternal oxide
#

also your raytrace shoudl use the players Eye location and direction

slim kernel
chrome beacon
#

Probaby Eclipse.. their compiler is a bit special and capable of removing bad code

chrome beacon
#

Then I have no idea

#

That should error

eternal oxide
#

Probably InteliJ, its a bit special and protects people from learnign the basics šŸ˜›

quaint mantle
#

IntelliJ is the best

#

šŸ˜Ž

slim kernel
#

but if its not a fallingBlock anymore how can I set velocity?

eternal oxide
#

you can never set velocity on a block

#

you need to spawn a falling block

ornate heart
#

Use World#spawnFallingBlock i think

slim kernel
#

I will try that thank you all

silk tusk
#

Is there any way to open an anvil view that isn't an actual anvil (Like won't automatically set the output)? I want to make a custom GUI using the anvil, but overriding the anvil events is getting kind of messy.

eternal oxide
#

yes create an inventory of type Anvil

#

um perhaps not. I thought Anvil worked the same as Workbench

sage swift
#

cancelling PlayerInteractAtEntityEvent does not prevent piglin trading... is there a way to do so?

eternal oxide
#

you mean teh PiglinBarterEvent?

sage swift
#

cancelling PiglinBarterEvent literally does nothing, lol

#

old versions are unsupported

eternal oxide
#

If you have never made a plugin before I recommend you make an up to date one before attempting one on a version you will get little to no help on.

sage swift
#

but yeah PiglinBarterEvent cancellation has 0 effect on any method of trading with piglins

eternal oxide
#

Trading as in throwing things on the floor so they pick them up?

sage swift
#

it cancels neither, but ive stopped that with cancelling EntityPickupItemEvent

#

players can still interact with the piglins though

#

PlayerInteractAtEntityEvent is called but cancellation does nothing

eternal oxide
#

The barter event is only for them picking items off the floor

sage swift
#

(doesnt work for that either)

eternal oxide
#

It shoudl, but its possible its broken I guess

sage swift
#

in any case, i see no way of stopping piglin trading

#

other than maybe setting the output to the very same gold

eternal oxide
#

If the barter event is broken for you I'd expect others to be broken for piglins too

#

So you may be out of luck

sage swift
#

oh, it doesn't work cause my version doesnt have PiglinBarterEvent

#

need to update

#

ok, so cancelling the barter event stops an item from coming out

#
    @EventHandler
    public void on(PiglinBarterEvent evt) {
        List<ItemStack> drops = evt.getOutcome();
        drops.clear();
        drops.add(evt.getInput());
    }``` that works, lol
eternal oxide
#

lol

#

That poor piglin

#

You are giving him diarrhea

ionic rapids
#

how can i create a spigot and bungeecord plugin ? I mean both of them work with the same jar file.

eternal oxide
#

two main classes, one extends JavaPlugin, the other extends Plugin from Bungee

ionic rapids
#

importing the bungee file and the spigot ?

eternal oxide
#

you add a plugin.yml and a bungee.yml

ionic rapids
#

for the lib

#

ok

#

thank

sage swift
#

can they share/access each other's classes though

#

that's the real question

#

and the answer is no

eternal oxide
#

yes they can

#

not spigot/bungee if you mean that

#

but plugin classes, yes

languid geode
#

it should stop the trade but the piglin will still pickup the barter item

slim magnet
#

does EntityDamageByEntityEvent get called even if the entity being hit is set invulnerable

fair panther
#

Does anyone know how to make custom weapons using a texture pack and NBT files?

scarlet cape
#

I thought it was impossible

fair panther
#

??

dense goblet
#

Is there a way to get the destination slot from InventoryMoveItemEvent

#

e.g. when a hopper puts an item into a furnace

slim magnet
#

Whats a minecraft sound that sounds kinda like a forcefeild?

gritty flame
#

Wolf pup dying noise

wraith rapids
#

lol

slim magnet
gritty flame
#

Or angry villager noise

compact haven
#

those are terrible choices

compact haven
dense goblet
#

enderdragon hurt at high pitch

#

kinda weirdchamp but worth a listen

slim magnet
gritty flame
#

Any devs who need builds done and wanna do dev work for builds lmk, I can also throw in discord phone s3x

patent ice
wraith rapids
#

what are you building

gritty flame
#

Depends what is needed

wraith rapids
#

i don't really need builds

patent ice
queen dragonBOT
dense goblet
#

he just wants the phone s3x

wraith rapids
#

but I could maybe do something for a handful of 5 star reviews on my plugin

gritty flame
#

Lmao maybe if the scale weren’t too large, I’d have to leave a couple thousand reviews to come close to paying

#

Oof I meant like 2-3 250x 250 builds

compact haven
#

just update the plugin with a script 1k times, then have him leave a review for each update with "Very good update. Developer was very quick to make changes, even recoded the plugin 50 times for me"

patent ice
#

LeL

#

Or just get legit meaningful reviews šŸ¤”

compact haven
#

that requires putting at least 5% effort in the plugin

#

and thats like a lot of work

gritty flame
#

True that’s a lot

compact haven
#

what are you even looking for dragonze

wraith rapids
#

implying reviews are ever meaningful

compact haven
#

"help theres a bug it doesnmt work eror: (300 line error)"

gritty flame
#

I’m trynna make a game like clash of clans in minecraft. Is how I would put it

wraith rapids
#

glhf

#

is how i'd put it

gritty flame
#

Very

patent ice
#

Someone's already making it FYI

#

Kidding, they gave up after a few months.

gritty flame
#

Well I can learn how to dev (hopefully before college) myself, and the builds are already done

wraith rapids
#

someone write me a decent crates plugin

gritty flame
#

Just enemy design and game design left

wraith rapids
#

sounds like a good dev excercise

compact haven
#

LMAO

wraith rapids
#

i'll let you write a crates plugin for me

patent ice
#

Use CrazyCrates they work fine

wraith rapids
#

in return you can 5 star my plugin

patent ice
#

I'll 5 star your plugins for free

wraith rapids
#

crazycrates last i tried was trash

gritty flame
#

I’ll let you do work for me lmao

#

U gotta offer something

patent ice
#

Link your plugins I'll 5 star them rn

wraith rapids
#

i need to be able to give out items with arbitrary pdc tags and shit on them

#

and most crate plugins i've come across don't let you set the pdc/internal meta contents

compact haven
#

looking for PAID developers, requirements below
5 years development
4 in java
3.5 in spigot
deep knowledge with sql
must be a linux master, extremely good with ubuntu
at least 5 hours a day

pay will be offered if the server makes money

#

thats the real kekw

patent ice
#

Don't work with kids and you'll get paid properly

#

My friend used to get paid $35/h as a plugin Dev for some server

wraith rapids
#

i can offer you my consultation and design services

#

but i won't have the effort to write any code probably

compact haven
#

lmaoo

#

ur consultation is free

#

just make it seem like a noob problem and post here

#

and boom consultation

wraith rapids
#

it's free until you offer to pay something

compact haven
#

Ill give you a positive comment on ur non existent mcm profile?

gritty flame
#

I find all good devs are lazy so they charge 35$ an hour and will take 25 hours making a plug-in that should take 10 tops, and the bad ones all have good commercial practices

wraith rapids
#

i should make an async paper 1.8 multithread fork

#

and sell it on mcm

patent ice
#

ASync sucks

wraith rapids
#

async cannoning

compact haven
#

unless you're a dev yourself and you have written it before, it's hard to assume how long something will take

wraith rapids
#

paying by the hour is dumb anyway

#

then again so is paying per project

#

i guess capitalism is dumb

compact haven
#

then how do you propose payment xd

patent ice
#

Paying per hour is easier to convince the client

compact haven
#

is the economy dumb next

dusty herald
#

I like being paid per project so I know how much money I would be getting is fixed

wraith rapids
#

pay per hour and you have a sleeze lazing around half of the time getting nothing done

#

pay per project and you get a rushed piece of shit

dusty herald
#

why not both then

scarlet path
#

Is there a way to use Textcomponents in kick messages?

wraith rapids
#

the meme necromancer

dusty herald
#

why would you

scarlet path
#

for links

wraith rapids
#

i don't think click events work there

dusty herald
#

you can't do that Glub

scarlet path
#

shit okay thanks

gritty flame
#

I’ve worked on multiple servers (just me and one other person) who is a dev, and they told me on multiple occasions that usually the building process takes longer and builders get payed less because everyone wants to be a builder and none devs (keep in mind the builds are 150x150) (and the plugins required around 500-600 words each). Although your right I cannot comment on the difficulty of said time spent, the fact that is not only noticeable but so much so that a dev I was paying was willing to admit he did little to no work was odd. Especially because the project seemed huge compared to the asking prices online

dusty herald
#

plugins require 600 words? what do you mean by that

wraith rapids
#

150x150 is a tiny ass build

#

i'm going to need like a 1000 by 1000 island

gritty flame
#

Maybe it’s just me but 150x150 is pretty damn huge... like larger than most small hypixel Skyblock islands (and there were 5 on the server this large)

dusty herald
#

150 is small

wraith rapids
#

you can walk 150 blocks in like a few seconds or something

#

i guess it depends on the amount of detail

dusty herald
#

but seriously what do you mean 600 words per plugin

compact haven
#

^

#

developing isnt mashing together sentences

wraith rapids
#

if you meticulously plan every block for 200 hours yeah it's pretty big

dusty herald
#

if you're talking about skript development šŸ‘€

compact haven
#

also I plan extensively for large plugins, to get the workflow and layout in my head before I start coding

gritty flame
#

He said on average for the server he wrote like 600 words and tbh I don’t even know either, it just seems like a small period of time

wraith rapids
#

writing the stuff is the easy part

#

making it work and designing it in a way that doesn't explode later is the hard part

#

a trained monkey can mash buttons on a keyboard

compact haven
#

depending on the stuff you can also run into problems

patent ice
#

TF you mean words for plugins

wraith rapids
#

stuff like source lines of code or instruction count or character length or word count are all pretty poor metrics of project complexity

dusty herald
#

public void onEnable() {
System.out.println("plugin enabled");
}

#

done

wraith rapids
#

marginally better than filesize though, i suppose

dusty herald
#

I mean all I have to do is shade in the Spigot API /s

#

big bucks

wraith rapids
#

why stop with the api

#

shade in the server

#

and the authlib and apache commons

#

and gson and everything

#

once saw like a 150mb plugin by some random fuck who was trying to do nms for the first time

dense goblet
gritty flame
#

And some devs are even shadey enough to price configure edits at $20 a plugin. Something a monkey (like myself) learned on YouTube while doing the dishes

dusty herald
#

I charge on complexity of the plugin and what I believe the amount of time it would take to create at the beginning

dense goblet
#

600 words is like 50-180 lines of code lol

#

maybe they were just really good lines of code but still

wraith rapids
#

i don't do development for money because I already have money and I don't want to tie myself down with promises to keep

gritty flame
#

One that causes structures to spawn when right clicked, made it so u couldn’t spawn structures out of bounds, or place structures out of a grid. And also caused a invisible entity to spawn there.

dusty herald
#

I stray away from large projects because fuck that noise

gritty flame
#

So the first half of the buildings plugin for the clash thingy

wraith rapids
#

the only part about that that seems difficult or annoying is the generating structures part

#

and that's just because the worldedit api gives me fucking pimples

gritty flame
#

Second half being the effects of said tower playing where the invisible entities are when being attacked which took more words (around 1000)

dense goblet
#

all I know is even the most amateur programmers can get paid ridiculous cash for easy projects

patent ice
#

It isn't rediculous if the client doesn't know how to program thenselve

wraith rapids
#

anyway, you wanted to learn to dev right

patent ice
#

Themselves.

gritty flame
#

Yes

dense goblet
#

have a friend who did some work for uni which was like a tiny bit of python (barely knowing python, at that) and got paid like $40 an hour calculated

wraith rapids
#

give me a 1000 by 1000 island and i'll teach you how to dev and write the clash of clans or whatever thing yourself

gritty flame
#

Yes any computer science not regulated is over priced

patent ice
#

1000 by 1000 bruh

#

Are you mental

dense goblet
#

I think he using feet

patent ice
#

You don't need an island that big

wraith rapids
#

you probably want to do the base of the build with a world editor

#

and only add details manually

patent ice
#

Add details manually to an 1000 x 1000 area

#

You must be mental

wraith rapids
#

one of my builders has done a few of these but they do take a while

#

and he has other shit to work on rn

patent ice
#

It's possible but unnecessary

dense goblet
#

have you done any programming before @gritty flame ?

wraith rapids
#

iirc he uses worldpainter, or whatever it was called

patent ice
#

If you wanna learn how to dev, YouTube is your friend

gritty flame
#

I learned how to make maps using command blocks lmao that’s about it

sleek pond
#

commandblocks are gay

patent ice
#

You're gay

wraith rapids
#

it can generate structures and rudimentary details and shit so most of the labor is done by the editor

gritty flame
#

But to be fair I ended up using like 3000 commands so if it’s anything like that then I’ll be fine, if not I’m fucked

sleek pond
#

what type of map?

wraith rapids
#

did you know f.e that bethesda did not manually design the world map for skyrim

patent ice
#

A map

wraith rapids
#

it was shat out by a generator

#

and they just added details and features to it

sleek pond
#

lol

#

f.e?

wraith rapids
#

for example

gritty flame
#

The terrain was not the map itself

sleek pond
#

wat

gritty flame
#

Tats what he means nvm lol

wraith rapids
#

so

dense goblet
#

learning spigot is mostly googling stuff and knowing what questions to ask

wraith rapids
#

when do i get my island

compact haven
dense goblet
#

learning programming is mostly about writing bad code and realising why its bad later down the line

gritty flame
#

I just meant to that one asshole charging $25 for feather board edits lmao

#

Because that’s the majority of the market

compact haven
#

people who think you can learn how to code with top tier skill in a month

#

and set themselves time limits and all of that

#

wont ever get far in programming unless they change their view on it

wraith rapids
#

you just need a high tier xp boost

compact haven
#

bro I got a few xp bottles in my trunk

#

they are like the generic kinds that I can choose what skill to boost

gritty flame
#

I’m carrying a titanic exp bottle in my sack

compact haven
#

I just drink them before I go to sleep and boom I improve overnight

wraith rapids
#

what is clash of clans anyway

#

isn't it like some 2013 mobile game or something

gritty flame
#

Mobile base builder

#

Yes

wraith rapids
#

the one with the barbarians and balloons and walls and shit

#

how would that work in minecraft anyway

dense goblet
#

if you wanna get started writing plugins you should start with a simple hello world program in java, then do something like a bmi calculator, and then either do some small projects to learn more about OOP concepts and such or give spigot a go and start simple

#

whichever way you go the most important thing is try to get a sense for when you're doing something wrong, that way you know when to try and find a better way to do it

#

if code becomes manual labour that's a clear sign that there's likely a better option

gritty flame
#

Player is always in creative cannot spawn items and spawn in a empty lot with a town hall and goes through a tutorial which underlines how to use a item in their hot bar to build buildings and defence. Then after said tutorial a automated attack happens to show the player why they are building a base, before showing the player hoe to attack (there is an npc you must talk to). Then you learn how to attack (first person raid on another players base where punching buildings damage them deals damage represented by a holographic display health bar. Depending on how much u destroy you get a certain amount of currency) the currency can be used to place and upgrade buildings at your base. Repeat the attacking and upgrading process until max level.

wraith rapids
#

right, first

#

don't use creative

#

the protocol around creative mode is horrible and opens up massive gates for exploits

gritty flame
#

Ok

wraith rapids
#

creative mode servers need to use enermous filter and watchdog plugins that consist of like a million lines and set you back like a hundred bucks just so they don't get nuked

#

how do you attack with a hoe

#

do you punch shit

#

or do you spawn in barbarians or whatever

gritty flame
#

U spawn in stuff

#

Should have clarified

#

One of the buildings let’s u choose what troops u bring into attacks

wraith rapids
#

sounds straight forward enough

#

though dealing with ai goals would be a pain

dire marsh
gritty flame
#

Actually only two different attack types, ones who target walls and defences, and ones who attack all so having the mobs who attack them use zombie and add an invisible villager

#

Inside walls and defences

wraith rapids
#

better to use either paper's pathfinder api or mob goals api

#

former might be more performant but the latter will probably be simpler to set up

#

well, let's get started then

#

mister i want to be a developer

#

i recommend intellij and maven

gritty flame
#

Lmao u do?

#

Ok that sounds great

dire marsh
#

how u gonna let people build the buildings

wraith rapids
#

they'll probably pop up from some gui or something, dunno

gritty flame
#

Yeah GUI prolly

wraith rapids
#

now to rewrite slimefun energy networks

gritty flame
#

And all buildings are the same size (1 tile) so u don’t have to outline size or anything

dire marsh
#

u could be fancy and do preview stuff and let them move around or smth

wraith rapids
#

you could be extra fancy and use a resourcepack with custom models

#

models can be of unlimited scale afaik

compact haven
#

no

wraith rapids
#

so a single item could be used to display an entire building

compact haven
#

block models are limited to 3x3x3

wraith rapids
#

no? sad

gritty flame
#

Sad

wraith rapids
#

well, it'd need more individual models then

compact haven
#

and to use a block model u need to replace a block state

gritty flame
#

I’ll make a discord rn

wraith rapids
#

just make an armorstand wear an item with a model

compact haven
#

though u could use item models

wraith rapids
#

do resourcepacks even support block models?

compact haven
#

yes

#

ofc lmao

wraith rapids
#

weird

#

last I talked about it with someone people said they didn't

compact haven
#

u do need to replace a block state for a custom model though

#

theres like 160+ if u replace all mushroom block states

#

800 with noteblocks

wraith rapids
#

noteblocks are more feasible

#

as you don't actually need any of those states

compact haven
#

im actually writing a plugin for personal use

wraith rapids
#

since the sound is serverside and they all have the same vanilla texture

wary harness
#

So that can't work with other bloclz

compact haven
#

would automatically generate the resource pack based on assets in a yaml file

#

but would be a tad limited

wraith rapids
#

is there a size limit on item models?

compact haven
#

that I dont know

wary harness
#

Probably max int

compact haven
#

not everything is limited to 2.14 million

wary harness
#

Sorry me jumping in story

wraith rapids
#

seems to have the same limit as block models

wary harness
#

Ah u never know

gritty flame
#

Just made a discord for the server lmao

#

Not advertising telling someone

ivory sleet
wraith rapids
#

it says i'm in it but i can't find it in my serbur list

#

there

#

god i hate slimefun

gritty flame
#

Weird lmao

wraith rapids
#

i also hate intellij

#

so i was renaming a package, right

#

it got the refactor done, so all of my classes now refer to the new package

#

but then it blew up with an ioexception and didn't actually rename the package

#

so now all of my classes are fucked

ivory sleet
#

I don’t think Eclipse would do a better job but might wanna try that one then

wraith rapids
#

imagine handling exceptions

quaint mantle
#
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.Listener;

public class EventsClass implements Listener {

    @EventHandler
    public void onjoin(PlayerJoinEvent event) {
        player player = event.getPlayer();

        player.sendMessage("MESSAGE");
    }
}``` so i dont understand but the Player in the last one and the player on above that 1 but just the first 1 right is in red why?
patent ice
#

Imagine being named NNYaKNpGms0eUVpiSdHx

wraith rapids
#

player is not a class

#

Player is a class

#

player is not

subtle vector
#

is there a way to find if a trident landed?

quaint mantle
#

what do you mean

subtle vector
#

player is a object of Player class right?

wraith rapids
#

you wrote player

patent ice
#

Camel text

wraith rapids
#

you need to write Player

quaint mantle
#

and how do i create a class

wraith rapids
#

you don't

quaint mantle
#

with a capital P

wraith rapids
#

you refer to the Player class

ivory sleet
#

The type of that variable is Player iCalling so it should be
Player player
rather than
player player

quaint mantle
#

ok

ivory sleet
#

And types are based of classes

wraith rapids
#
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.Listener;

public class EventsClass implements Listener {

    @EventHandler
    public void onjoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();

        player.sendMessage("MESSAGE");
    }
}```
#

learn java, basically

quaint mantle
#

also the first player in player.sendMessage("MESSAGE"); is red so do i do a big p?

wraith rapids
#

no

#

look up a tutorial

#

you have no clue what you are doing

ivory sleet
#

You import org.bukkit.entity.Player

#

iirc

quaint mantle
#

ok

patent ice
#

Bruh learn what camel text is

quaint mantle
ivory sleet
#

Bad ones then

patent ice
#

Camel case*

quaint mantle
#

also when i debug it says "non-static method sendMessage(java.lang.String) cannot be referenced from a static context"

subtle vector
#

Coded red is a great youtuber for spigot tutorials @quaint mantle

wraith rapids
#

learn java

pearl hollow
#

im trying to add and use multiple configs, the configs copy themselves over to the data folder and have the values i put inside them, but I cant access the config information

quaint mantle
#

ok thanks

patent ice
#

He needs to learn java before spigot

wraith rapids
#

he doesn't need spigot tutorials

wraith rapids
#

he needs a "what the fuck is java and what do i do with it" tutorial

subtle vector
#

sololearn is great for jlearning ava if ur doing by urself

quaint mantle
#

thank you so much guys

pearl hollow
quaint mantle
#

and sorry for wasting time and sucking at java

ivory sleet
#

It’s fine

#

But learning java will help you avoid pre beginner mistakes

#

And that will save everyone’s time

ivory sleet
pearl hollow
#

kk im going to put it in a pastebin

paper viper
#

lmao

ivory sleet
#

Oh lol

quaint mantle
#

also is intelij good or bad

dense goblet
#

intellij is good

paper viper
#

just choose any ide you just need to learn java smh my head

dense goblet
#

yea look up an intro to java course there should be plenty online

ivory sleet
#

For a beginner it doesn’t matter at all which ide

subtle vector
#

intellij is cool

paper viper
#

beginners fuss all over about which ide to start with

dense goblet
#

Word

ivory sleet
#

Yeah I mean you can always switch later

paper viper
#

i literally switched from eclipse to intellig in 1 day

#

you remember that day Conclure

patent ice
#

Best IDE is intelliq

paper viper
#

right

ivory sleet
#

I did it after a month lol

paper viper
#

I did it after 1-2 years

quaint mantle
#

its codeaccademy good like the course i dont know if you have heard of it but is it good for people who have no clue what they are doing

ivory sleet
#

Idk I mean Eclipse is arguably more ram friendly lol

#

But that’s like the only positive thing imo

paper viper
#

Because it doesnt index shit

dense goblet
paper viper
#

as much

#

lmao

patent ice
#

Eclipse is annoying

ivory sleet
#

Yeah true

paper viper
#

intellij is super annoying at the beginning

#

with indexing

#

like very

quaint mantle
ivory sleet
#

I mean it has a global project overview

dense goblet
#

good luck!

patent ice
#

CodeAcademy is alright

#

But tbh YouTube has everything

#

Or Udemy

ivory sleet
#

I would suggest to use a textual tutorial since that will give you the benefit of going back to older references trivially

quaint mantle
#

alright then

pearl hollow
paper viper
#

ohhh god

#

Ok

#
  1. Stop using lombok cause you dont know how to use it
#

you seem to use it only for static fields lmao idk why

#

and those fields can be put into some manager class

wraith rapids
#

wtf

#

i'll pulse your ass

paper viper
#

lol pastebin even lagged for me

pearl hollow
#

lol

paper viper
patent ice
#

😳

paper viper
#

😫

ivory sleet
#

Sir this is help development

paper viper
#

thats kinda depressing ngl

#

lmao

#

that last gif

#

xD

ivory sleet
#

Why is this guy mad sus

paper viper
#

lmao

#

its like that gif

patent ice
#

It's my favourite one, idk how discord allows it

ivory sleet
quaint mantle
#

wait

#

when i join the server

#

its not sending me the messages

patent ice
#

It's coz you're too dlow

#

Slow

pearl hollow
compact haven
paper viper
#

You know i would say that

#

but then like 100 people

#

would go after me and get pissed

#

lmao

compact haven
#

xd

dusk flicker
#

lombok is nice

#

OH WHAT THE FUCK

#

just opened that file

quaint mantle
#

yo wtf

#
@Getter @Setter private static File spawnFile;
    @Getter @Setter private static FileConfiguration spawnConfig;
 
    @Getter private static File messagesFile;
    @Getter private static FileConfiguration messagesConfig;
 
    @Getter @Setter private static File queueFile;
    @Getter @Setter private static FileConfiguration queueConfig;
 
    @Getter private static File scoreboardFile;
    @Getter private static FileConfiguration scoreboardConfig;
 
    @Getter private static File serverSelectorFile;
    @Getter private static FileConfiguration serverSelectorConfig;
 
    @Getter public static List<Player> buildPlayers = new ArrayList<>();
public void loadConfig() throws IOException {
 
        messagesFile = new File(getInstance().getDataFolder(), "messages.yml");
        messagesConfig = YamlConfiguration.loadConfiguration(messagesFile);
 
        scoreboardFile = new File(getInstance().getDataFolder(), "scoreboard.yml");
        scoreboardConfig = YamlConfiguration.loadConfiguration(scoreboardFile);
 
        serverSelectorFile = new File(getInstance().getDataFolder(), "server-selector.yml");
        serverSelectorConfig = YamlConfiguration.loadConfiguration(serverSelectorFile);
 
        getConfig().options().copyDefaults(true);
        messagesConfig.options().copyDefaults(true);
        scoreboardConfig.options().copyDefaults(true);
        serverSelectorConfig.options().copyDefaults(true);
 
        saveConfig();
        saveResource("messages.yml", false);
        saveResource("scoreboard.yml", false);
        saveResource("server-selector.yml", false);
    }
sleek turret
#

MY EYES!!!!

quaint mantle
#

lol

pearl hollow
#

what do i do tho

sharp bough
#

it cant get any worse than that

pearl hollow
#

fr tho?

sharp bough
#

poor guy he just wanted to help lmao

pearl hollow
#

so idk why I get null values when i try to get them from the config?

languid geode
#

oh no heres the help, learn java and came back after

sharp bough
#

i didint read the edit

#

hahaha

pearl hollow
#

lol

#

my code sucks

sharp bough
#

i mean if it works it works

pearl hollow
#

but it doesnt 😭

sharp bough
#

but you might wanna check some tutorials clean it up

pearl hollow
#

ahh

sharp bough
#

im sorry

#

yea maybe you dont have enough experience

#

or should start with something simple?

#

how long have you been codign for?

pearl hollow
#

so it copies the configs into the data folder with the values i put in, but whenever i do something like myConfig.getString("scoreboard-title") it doesn't work

sharp bough
#

show the config.yml

worldly ingot
#

You also have to saveConfig() any time you make a change that needs to be written to disk

sharp bough
#

did you add it to the config.yml in the resources folder?

pearl hollow
#

yes

worldly ingot
#

Oh I even misread the question lol my bad

#

Disregard

quaint mantle
worldly ingot
#

Well, I'd almost chalk it up to the fact that you're calling loadConfiguration() before you're saving the file

#

You probably want to saveResource() before you loadConfiguration()

#

would theoretically work on the second run, but on first run it won't

quaint mantle
#

choco

#

how do i be like you

pearl hollow
#

kk ill try that

sharp bough
#

choco's github is my wet dream

#

i would simp for choco

ivory sleet
#

Damn that’s a lot of contributions

pearl hollow
#

sheesh

worldly ingot
#

FeelsOpenSourceMan

#

I still regret not finishing Aftershock more completely

sharp bough
#

choco make a tutorial on how to be you

worldly ingot
#

PES_SadShrug Just wake up and program. 'tis my life

sharp bough
#

sounds like a good life to me

compact haven
#

@worldly ingot where do u get the motivation to finish ur projects

dusk flicker
#

cocaine

#

just like the rest of us

sharp bough
#

yea

#

you should try too

#

its quite effective

worldly ingot
compact haven
worldly ingot
#

I'm extremely bad at that

compact haven
#

same

sharp bough
#

hahahah

compact haven
#

I have like tens of projects just sitting in recents

worldly ingot
#

Source:
<#general message>

compact haven
#

@kindred dust always makes fun of me for it

quaint mantle
#

dont worry

ivory sleet
#

🄲

quaint mantle
#

i never finish my projects

sharp bough
#

its because the motivation is gone and you already have what you want so its not new anymore

#

and now you have 1 idea

compact haven
#

lax's messages are just always the best

#

or the worst

sharp bough
#

and 1 unifnished proyect

compact haven
#

its really a catch all

ivory sleet
#

I avoid project disbanding by starting small

silk tusk
#

does the on inventory close event trigger when the player leaves the game with an inventory open?

sullen marlin
#

Yes

#

Also why not just test it

silk tusk
#

thanks, that should make my code a bit cleaner

#

I probably should've just tested it

near aurora
#

Hello, I'm trying to set a string in a custom yml and it keeps showing like this any help thanks

paper viper
#

context?

near aurora
#
configuration.set("licence.Key", "ENTER-YOUR-LICENSE-KEY");
                    saveYml();```
#

?

paper viper
#

isnt that expected behavior?

compact haven
#

^ lmao

paper viper
#

lol

near aurora
#

no

paper viper
#

It is

compact haven
#

what do you think its supposed to do

paper viper
#

the dots separate between the categories

compact haven
#

because thats doing what its meant to do

near aurora
#

this bit ain't in "ENTER-YOUR-LICENSE-KEY"

paper viper
#

ah

#

quotations

near aurora
#

yeah

compact haven
#

uhm

#

yaml doesnt require quotes

paper viper
#

its not necesary

compact haven
#

only for certain situations

near aurora
#

It won't read it otherwise

compact haven
#

yes it does

#

it reads perfectly

paper viper
#

^

near aurora
#

It shows errors

compact haven
#

yaml != json

#

what errors

#

you must share

paper viper
#

and also if you really wanted to you can escape the quotations

#

but you shouldnt have to

near aurora
#

two sec

paper viper
#

like do that

near aurora
#
java.lang.NullPointerException: null                                                                                            at java.util.regex.Matcher.appendReplacement(Unknown Source) ~[?:1.8.0_291]                                             at java.util.regex.Matcher.replaceAll(Unknown Source) ~[?:1.8.0_291]                                                    at java.lang.String.replaceAll(Unknown Source) ~[?:1.8.0_291]                                                           at net.milkbowl.vault.Utils.ULicense.requestServer(ULicense.java:72) ~[?:?]                                             at net.milkbowl.vault.Utils.ULicense.isValid(ULicense.java:150) ~[?:?]                                                  at net.milkbowl.vault.Utils.ULicense.verify(ULicense.java:42) ~[?:?]                                                    at net.milkbowl.vault.Vault$1.run(Vault.java:106) ~[?:?]                                                                at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-753]                                                                                                                              at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.16.5.jar:git-Paper-753]                                                                                                                     at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.5.jar:git-Paper-753]                                                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:1.8.0_291]                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:1.8.0_291]                                    at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]  ```
paper viper
#

that is nothing even similar at all

#

how is that even related to yaml?

compact haven
#

LMAO

paper viper
#

do you even see anything in there that says "yaml"

near aurora
#

yes it is because if I put quotations around it, the error gose away.

paper viper
#

That means how you are retreiving the value is incorrect

compact haven
#

it's erroring because ENTER-YOUR-LICENSE-KEY isnt a valid license key probably

paper viper
#

and anyways that too probably

near aurora
#

Okay never mind my bad.

paper viper
#

Lmfao

proud basin
#

Is it even worth making plugins for 1.8 anymore or should I just start making them for 1.12 +?

quaint mantle
#

1.13+*

proud basin
#

ok thanks

compact haven
#

uh no

#

I support 1.6.4+ on all of my plugins

#

?-?

deft geode
#

So I want to have a cow with a name to do something else when milked - should I use the EntityInteract event or what?

sullen marlin
#

Yes

sage swift
#

oh please dont use name for finding custom entity

#

oh please

#

i beg you

deft geode
sage swift
#

name tag šŸ™„ not gonna deal with that

silk mirage
#

I have got a doubt, Does Minecraft generate a UUID algorithm based or do they generate UUIDs according to their database?

scarlet path
#
ExampleSword:
  Material: STONE_SWORD
  DisplayName: '&a&lExample Sword'
DiamondSword:
  Material: DIAMOND_SWORD
  DisplayName: '&a&lDiamond Sword'
``` Lets say I have this in my config file. How would I loop through this and get the names of all the catagories? In this case I would want to get "ExampleSword" and "DiamondSword"
deft geode
quaint mantle
#

i think

#

or getConfig().getRoot().getKeys(false) if that doesnt work

silk tusk
#

I'm trying to set the block data tag on spawners in order to save the mob type and stuff, and it works fine when I place them in creative, but when I'm in survival the spawner just places as a pig anyway. Any clue how I can fix this?

quaint mantle
#

This is supposed to cancel the breaking of specific blocks

#

but it doesnt work, i dont get any errors.

silk tusk
#

you need breaks on each case

#

it runs through them all and then runs the default always

summer scroll
silk tusk
sage swift
#

BlockStateMeta

silk tusk
quaint mantle
#

Is there a way to get the block that the item dropped on?

sullen marlin
#

getLocation.getBlock.getRelative(DOWN) or something like that

quaint mantle
#

nah i figured it out

#

i just need to figure out why some of the items get lost

#

Hey guys, so I created a GUI, showed it to player, but now I want them to be unable to take/put stuff in the inventory, I guess I have to use the InventoryClickEvent but how can I know if the items they putted/took is on my GUI and not another plugin's GUI

sullen marlin
#

check if the inventory name is your gui name

quaint mantle
#

Alright thanks

quaint mantle
#

wait i didnt update it on my server

#

oh my gawd

#

i updated the plugin

#

the items get duped

#

instead of getting lost

keen kelp
#

how do I compare two ItemStack s while ignoring PDS?

#

would .isSilimar work?

sullen marlin
#

PDS?

keen kelp
#

presistent data something I forgot

quaint mantle
keen kelp
#

the thing that stores data in NBT

sullen marlin
#

only way would be to make two clones and clear the PDC on each

quaint mantle
#

?paste

queen dragonBOT
keen kelp
#

how do I clear PDC

eternal night
#

there is PDC#getKeys

keen kelp
#

one it clean without PDC so it's not that complicated fortunatly

quaint mantle
sullen marlin
#

.equals not ==

#

== doesnt work on strings

quaint mantle
#

Okay thanks again

#

And btw, how can we know if the click is because he took an items, of if it's because he putted an item

keen kelp
#

if youre trying to log to the console use Bukkit.getLogger()

#

.getAction

quaint mantle
keen kelp
#

that returns a InventoryAction

#

you can read up the javaDocs on that one

#

where does playItem come from

#

@quaint mantle

quaint mantle
#

its a hashmap

keen kelp
#

hahsmap<Item, Player>?

#

oops

quaint mantle
#

Yes

#

in the beginning of the class

keen kelp
#

ok what result were you expecting

#

and what did you get

quaint mantle
#

i were expecting to get stone when cobblestone was thrown into fire, but i didnt get the exact amount. when i insert a stack of cobblestone i get extra 4 stones.

#

the dupe amount changes

#

How can we know in which slot the Item was picked in InventoryClickEvent

#

when i throw it continously

keen kelp
#

so you spam q and throws an entire stack of cobble into fire

#

and you got 68?

quaint mantle
#

Yeah

#

the dupe amount changes though

keen kelp
#

and it's inconsistent

#

ok have you tried logging anything yet

quaint mantle
#

Wym

keen kelp
#

like adding Bukkit,getLogger.info(String.valueof(item.getItemStavk.getAmount));

#

inside the second if

#

typo

#

but this would tell you how much item is given to the player

#

everytime something combusts

#

since youre spamming q it should always be 1

#

if any result has more than that, there's your problem

quaint mantle
#

When i throw the items stacked, i get one.

#

when i try that

keen kelp
#

when you throw a single stack of 64 cobble into the fire and it burns, you only get one back?

quaint mantle
#

with the code i sent you, no it doesnt.

#

when i change the amount to 1 it does

keen kelp
#

makes sense

#

have you tried spam q ing when you hard code the number to 1?

quaint mantle
#

Yes some of the items get stacked

#

and get lost

keen kelp
#

so as a result you get less than 64

quaint mantle
#

Yep

keen kelp
#

hmm

#

ok first

#

Im pretty sure Item's have .getThrower

#

that returns UUID

#

so you can just do Bukkit.getPlayer(Item.getThrower)

#

instead of hashmap

#

since some items get stack so some never get removed and that would build up

#

oh no ElgarL is here did I say smth wrong

eternal oxide
#

If you are talking about players dropping items, it would probably be the PlayerDropItemEvent, which has a getPlayer

keen kelp
#

he's tryna get the owner of the item that's combusting

#

or the thrower rather

#

he's currently adding player to hashmap when they throw items and getting then in EntityCombustEvent

eternal oxide
#

if you set the player in the Items meta in the PlayerDropItemEvent they will only combine with items with the same meta.

#

you can then retrieve the meta in the combust

quaint mantle
#

btw i am using 1.12.2

eternal oxide
#

items have meta in 1.12

keen kelp
#

but Item doesn't have .getThrower :/

#

in 1.12

eternal oxide
#

in the PlayerDropItemEvent you get the player, put their UUID into the item meta

keen kelp
#

yeah I was thinking of that

#

since that's better than hashmapping

#

as it wouldn't leave some entries

#

oh also ElgarL, how does one clear PDC from an ItemStack

eternal oxide
#

for loop over keys

keen kelp
#

ah frick

eternal oxide
#

for (NamespacedKey key : container.getKeys())

#

container.remove(key)

keen kelp
#

I was hoping looping wouldn't be necessary for comparing items

#

but ig this is da way

eternal oxide
#

write your own isSimilar method

keen kelp
#

I was thinking a StripePDC method

eternal oxide
#

The issue being its possible not all keys are yours

keen kelp
#

nah it's fine no other plugins are gonna touch these items

#

probably

#

Ill deal with it when I get to it ig

eternal oxide
#

If you are only interested in your keys java for (NamespacedKey key : container.getKeys()) { if (key.getNamespace().equalsIgnoreCase(plugin.getName())) {

keen kelp
#

but the key doesn't necessarily have the same name with the plugin right

#

what if I want to have modules and different namespacedkey for each

wraith rapids
#

the namespace does

#

your-plugin-name:your-key-name

#

namespace:key

eternal oxide
#

You should always be providing a plugin reference, then identifying your key in key.getKey()

keen kelp
#

Im confused

eternal oxide
#

key.getNamespace() = your plugin name. key.getKey() = the string you gave the key.

keen kelp
#

so when I create this NamespacedKey, I did new NamespacedKey(Main,"String")

#

that's fine right

eternal oxide
#

yes

wraith rapids
#

assuming Main refers to an instance of your main class, yes

keen kelp
#

yes

wraith rapids
#

but Main is not a valid variable name

keen kelp
#

yeah it's lower case

#

final Main main
public Class(Main main)
this.main = main

#

you get the point

wraith rapids
#

Main is also not a very good main class name

keen kelp
#

well

late dove
#

I have inventory 1 which opens with the command. This inventory 1 has several buttons that, when pressed, open inventory 2, 3 .... How can I make sure that when I click on a slot (for example, slot 0) in inventory 2, 3 ... the same action that is in inventory 1 is not played?

eternal oxide
#

You compare the getView().getTopInventory() with the instance of the currently open Inventory.

#

turrets?

wraith rapids
#

pew pew

eternal oxide
#

Translation error?

wraith rapids
#

instead of learning java I'd recommend learning english this time

#

yeah we're not crackshot support

#

ask the crackshot people

quaint mantle
#

sorry im new on the server

eternal oxide
#

How did you get the class that you can;t get the type?

wraith rapids
#

this is also not a development issue so you're in the wrong channel to begin with

quaint mantle
#

where is the channel for the crackshot

wraith rapids
#

i don't know

#

not in this discord, that's for sure

keen kelp
#

public ItemStack StripePDC(ItemStack item)
{
if(item.hasItemMeta())
{
PersistentDataContainer container = item.getItemMeta().getPersistentDataContainer();
for (NamespacedKey key : container.getKeys()) {
container.remove(key);
}
}
return item;
}

eternal oxide
keen kelp
#

oh

#

bruh

#

Stripe is the payment gateway right XD

sullen marlin
#

You need to setItemMeta

keen kelp
#

oh right

eternal oxide
#

^

sullen marlin
#

Cause getItemMeta is a clone

wraith rapids
#

consider making the method accept an ItemMeta instance rather than ItemStack

#

that way you're not forced to clone a new itemmeta just to use this method

keen kelp
#

.getPersistentDataContainer doesn't get a clone right

eternal night
#

no

eternal oxide
#

no, getItemMeta does

#

So you are working on a clone of the items ItemMeta

wraith rapids
#

but how did you get the class

#

surely you can get the type from wherever you got the class

eternal oxide
#

The returned Entity of the spawn method has a getType()

wraith rapids
#

yes, that is what he is describing

keen kelp
#

public ItemStack StripPDC(ItemStack stack)
{
if(stack.hasItemMeta())
{
ItemMeta Meta = stack.getItemMeta();
PersistentDataContainer container = Meta.getPersistentDataContainer();
for (NamespacedKey key : container.getKeys()) {
container.remove(key);
}
stack.setItemMeta(Meta);
}
return stack;
}

#

now?

wraith rapids
#

what

#

iterate over the entitytype enum and check getEntityClass().isAssignableFrom(clazz)

#

but there is probably a better way

#

that involves finding it from wherever you found the class

eternal oxide
wraith rapids
#

no clue

#

i'm assuming he doesn't want to actually spawn it

candid galleon
#

You can get the corresponding entity class from the EntityType

slim kernel
#

Can I somehow get the Material of the Block in the EntityChangeBlockEvent when the Block changes from falling to normal?
Because I tried and I only get Air or Grass if the Block lands on Grass...

candid galleon
#

but I don't think there's an inbuilt way to get the reverse

#

getBlock returns the old block and getTo returns the material that its going to change to

slim kernel
#

oh okay thank you

candid galleon
#

consequently, you can get the "old" material from getBlock and the new material from getTo

storm monolith
#

someone knows how I can stop a parrot from moving up and down with NMS?

#

I tried to override the onTick method and generating a new vector for the navigation but it still follow the default's movements

chrome beacon
#

Since it's NMS you're pretty much on your own. You'll have to dig around the source and override the pathfinding

slim kernel
#

Can I somehow change the Block after it changed in the EntityChangeBlockEvent because I tried: event.getBlock().setType(...) but it didnt do anything

lime sparrow
#

Hi

#

Can you help me please

opal juniper
#

Ok

#

So i have a bit of a problem

#

My plugin depends on a library which is very large

#

e.g 120MB

#

What should i do?

ivory sleet
#

is that vehicle plugin yours

opal juniper
#

the output is >130MB

ivory sleet
#

jeff maybe download it at runtime if u dont want to shade

#

oh well do you like remove the entity async or something?

opal juniper
ivory sleet
#

I mean you could wrap that with a try catch

ivory sleet
#

might wanna try that

opal juniper
#

ill have a look šŸ‘

slim kernel
#

Can I somehow change the Block after it changed in the EntityChangeBlockEvent because I tried: event.getBlock().setType(...) but it didnt do anything

hybrid spoke
valid vigil
#

Can I see and change the contents of an offline player's ender chest?

slim kernel
#

This one

quaint mantle
#

Ait I got a BlockBreak Event for when chests are broken but one of my things doesn't work unless I use static and I am trying to not use that.
ArenaManager class

    public static List<String> testerConfiguration = new ArrayList<>();
    public static List<String> chestConfiguration = new ArrayList<>();
    private final ArenaConfig arenaConfig;

    public ArenaManager(ArenaConfig arenaConfig, TIMV game) {
        this.arenaConfig = arenaConfig;
    }

BlockBreak Event class: https://paste.md-5.net/ijotoqexuw.cs
Main class for block break event:

pm.registerEvents(new BlockBreak(this, this.arenaManager), this);

Console error: https://paste.md-5.net/sihapepado.bash (line 27: arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)

Found out that setChestLocation is not the issue because it can't even be called? Something must be wrong with the BlockBreak event class (arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)

slim kernel
quaint mantle
young knoll
#

Try delaying it a tick

slim kernel
#

How can I delay it

slim kernel
young knoll
#

Use a runnable

slim kernel
#

okay will tray it thank yo

hybrid spoke
#

and what is "this.arenaManager"?

#

where do you declare it?

quaint mantle
#
    private final ArenaManager arenaManager;
    public BlockBreak(TIMV pl, ArenaManager arenaManager) {
        super(pl);
        this.arenaManager = arenaManager;
    }```
hybrid spoke
#

i mean this one sorry new BlockBreak(this, **this.arenaManager**)

quaint mantle
#

You mean how I like enable the event

#

cuz none of that is the issue, it all works but when I use it in a constructor, it doesnt

hybrid spoke
#

where you instantiate your arenaManager

#

you have a nullpointer

#

and i am trying to figure out where

#

and because i don't think its the player and neither the block, it have to be either the method setChestLocation or your arenaManager^^

quaint mantle
#
    private ArenaManager arenaManager;

    @Override
    public void onEnable() {
        this.saveDefaultConfig();
        ArenaConfig.setup();
        registerListeners();

        ArenaConfig arenaConfig = new ArenaConfig();
        this.arenaManager = new ArenaManager(arenaConfig);
    }```
#

setChestLocation ^

covert bluff
#

trying to make it so that a server operator can save the world using /save-world, and then they can do /reset-world to move the world back to the latest save

#
Player p = (Player) sender;
                World savedWorld = WorldResetterPlugin.getInstance().savedWorld;
                World pW = p.getWorld();
                WorldResetterPlugin.getInstance().getServer().unloadWorld(pW, false);
                pW.getWorldFolder().delete();
                WorldCreator wc = new WorldCreator("world");
                wc.copy(savedWorld);
                WorldResetterPlugin.getInstance().getServer().createWorld(wc);
                p.sendMessage(ChatColor.AQUA + "Done.");
                return true;
#

but this doesn't have any input for some reason

#

no error no input

hybrid spoke
#

for what is your super call in your event @quaint mantle

#

your arenaManager is null. maybe your super(pl) blocks it

quaint mantle
valid vigil
#

if I wanna make a custom inventory, is the proper way to make my own class implementing the Inventory interface?

hybrid spoke
valid vigil
#

Player.openInventory(customInventory), why would I need to implement InventoryHolder for that?

quaint mantle
covert bluff
#

trying to make it so that a server operator can save the world using /save-world, and then they can do /reset-world to move the world back to the latest save
but this doesn't have any input for some reason
no error no input

Player p = (Player) sender;
                World savedWorld = WorldResetterPlugin.getInstance().savedWorld;
                World pW = p.getWorld();
                WorldResetterPlugin.getInstance().getServer().unloadWorld(pW, false);
                pW.getWorldFolder().delete();
                WorldCreator wc = new WorldCreator("world1234");
                wc.copy(savedWorld);
                World newWorld = WorldResetterPlugin.getInstance().getServer().createWorld(wc);
                double pX = p.getLocation().getX();
                double pY = p.getLocation().getY();
                double pZ = p.getLocation().getZ();
                Location loc = new Location(newWorld,pX,pY,pZ);
                p.teleport(loc);
                p.sendMessage(ChatColor.AQUA + "Done.");
                return true;
young knoll
valid vigil
young knoll
#

To compare against the view in the various inventory events

#

You aren’t meant to implement bukkit interfaces

keen kelp
#

how do I have something run on a per-player timer

#

getServer().getScheduler().scheduleSyncRepeatingTask() is for global, how do I have something run per-player

eternal oxide
#

Its a timer, you do whatever you want inside it

keen kelp
#

but it's not per-player right

#

if I make something run 20seconds

hybrid spoke
keen kelp
#

hmm

#

intresting

keen kelp
#

so
getServer().getScheduler().scheduleSyncRepeatingTask()
and use hashmap?

#

per player and every like how long

#

I sound like it's really inefficient

#

Im trying to recreate natural regeneration

hybrid spoke
#

you have to assign the schedulertask to your integer and store it afterwards in the hashmap with the uuid of the player

#

but you could also just do one general task and for-loop through every online player

eternal oxide
#

regeneration, as in Health?

keen kelp
#

yes

eternal oxide
#

run a repeating timer with whatever interval you want, then when any player is injured you add them to a set.

#

your repeating task loops over teh set and heals each player in it a little. If they are fully healed you remove them

keen kelp
#

yeah but for exmaple

#

I set the timer to be 20seconds

#

there's no different between joining and waiting for 20secs and joining right before the 20th second

#

I dont think that's how natural regen was suppose to work?

eternal oxide
#

then add a timer till next regen, so a map, UUID, Long

keen kelp
#

so in main create a per tick task

eternal oxide
#

your timer loop runs every 5 ticks, and checks any players in the map time against the curren time

keen kelp
#

and every tick add 1 tick to each player

#

and when the tick is reached regen them?

eternal oxide
#

no

#

When a player is damaged you add them to a Map with a Now() + 20 seconds

keen kelp
#

but there will be thing that changes the player's max health

#

and that doesn't involve damaging?

gritty flame
#

Want to sign my petition, it’s the ā€˜Petition to Put Down my Grandma’.
You know I always hear her yelling like ā€œwhy is their rat poison in my soup!ā€, and ā€œwhere is my medicine!ā€. It really annoys me! So please sign to debilitate said annoyance.

eternal oxide
#

What? You were talking about regen, nothing about max health

keen kelp
#

is max health is increased

#

their health is no longer at max

#

therefore can regen

eternal oxide
#

in that case you are going to have to check every player every x number of ticks

#

if they are not at max set a time on them to begin regen

keen kelp
#

+1 ticker each tick for each player and when it's a multiple of X reset and regen yes?

eternal oxide
#

no

#

use Time

keen kelp
#

how?

eternal oxide
#

every loop of your timer you loop over all players (if not already in the Map, check their health/max health, if they have room ad them to the Map against LocalDateTime.Now() + 20 seconds

keen kelp
#

oh like actual seconds

eternal oxide
#

after that check is done for all players, you loop the Map and anyone who's stored time is less than Now() you heal

#

Just use System.currentTimeMillis()

keen kelp
#

why is that preferred over the ticker method

eternal oxide
#

you are not changing anything just checking a value against the system clock

keen kelp
#

this way their regen will be "faster" is the server is lagging right

#

relative to the server

eternal oxide
#

Neither way will be "faster" its time based

keen kelp
#

if the server is running at 10tps they would regen every 10seconds from the server's prespective tho?

eternal oxide
#

And its server side, so you only heal when the server tells you to

keen kelp
#

since real world time doesn't lag with TPS?

eternal oxide
#

Correct

keen kelp
#

and that's not ideal?

#

I wouldn't want players to regen faster if the server is lagging

eternal oxide
#

You woudl still only heal at teh rate the server runs

#

as the time is only the counter for when to start healing

keen kelp
#

ok so a player takes damage on 1900/1/1 00:00

#

they would be healed on 00:20

#

suppose the server got a huge lagspike

eternal oxide
#

depends if yoru timer runs every tick or every 5

keen kelp
#

and the next tick was on 00:25

eternal oxide
#

if there is a lag spike yoru heals woudl catch up when the server catches up

keen kelp
#

then they would health after one server tick

eternal oxide
#

lag = no server operation

keen kelp
#

yeah

#

so if the mobs and stuff aren't hitting player but they are regening

#

that wouldn't be good right

eternal oxide
#

Why not, you can only tell it to heal when the server says heal.

#

You can;t control lag

keen kelp
#

but if I use the ticker method

#

the regen lags with the mobs

#

wouldn't that be preferred?

eternal oxide
#

You will still only heal at the speed of the server TPS, in both instances. You don't miss or get any extra heals

keen kelp
#

if the server is running at 10TPS, it would health players 40 seconds since they got damaged

#

and if I use the time method they get healed 20 seconds later

#

but in that 20 seconds, mobs are attacking at half the speed since the TPS is 10

eternal oxide
#

yes, a timed method woudl result in healing startign as close to 20 seconds as you can, a ticker woudl be slower depending on the TPS

keen kelp
#

so a ticker is preferred right

eternal oxide
#

no

keen kelp
#

since if it acted based on real time

#

say a mob does damage every tick

eternal oxide
#

If you want it 20 seconds, then a timed. If you want it in ticks then a counter

keen kelp
#

the player is about to die

#

and ticker is still ticking down from 400ticks but we experienced a lagspike and the server lagged for 20 seconds

#

with the timer they would get healed and survive

#

with the ticker it only passed 1 tick and wouldn't heal

#

which is what's suppose to happen no?

proper notch
#

in general try to keep very game based things based on ticks

#

but say for instance you have a shop that resets every hour, use a scheduled executor service for that.

keen kelp
#

or else it would be like if the player can speed up/slow down time

#

==========================================

#

ok lemme think about this

#

Player is fighting a mob with a tiny amount of health left

#

they will get healed in 20seconds

#

but the mob is going to hit the player and kill them

eternal oxide
#

He is correct. If you want it all in sync with the server ticks you should use a counter.

proper notch
#

just base it off ticks. it makes more sense.

keen kelp
#

that's what I was saying

eternal oxide
#

You asked for 20 seconds not ticks therefore you'd so with a timer

keen kelp
#

I said a ticker was preferrable

#

it's an exampleeee

proper notch
#

the bigger problem here is probs a server freezing for 20 seconds

keen kelp
#

I should've said just 400ticks frick man

eternal oxide
#

Well, seconds and ticks are different things. Be precise šŸ™‚

keen kelp
#

it shouldn't but just in case

#

I was thinking like 20seconds worth of ticks

proper notch
#

when i developed battlepass we managed to use ticks for timings daily quest resets for like 18 months before we got any complaints

#

then we realised we should probs change it

keen kelp
#

since generally you dont base things in the server on real like times

eternal oxide
#

Yeah low tick servers getting daily rewards every 48 hours is not good.

ornate heart
#

Wow I just realized the problem

proper notch
#

yh someone came to us with that issue lol

ornate heart
#

I’ve been using ticks for real time stuff this whole time

keen kelp
#

bruh

eternal oxide
#

Towny had the same issue with newDay

proper notch
#

you dont notice it really unless you start losing a lot of ticks

ornate heart
#

So what’s the alternative

proper notch
#

ScheduledExecutorService is the best way