#dev-general
1 messages · Page 615 of 1
it also centralizes everything really nicely, so you don't have to guess where each config file is, it has to be in the mounted volume
Especially on stuff like Pterodactyl panel, you just have a File Manager that shows everything in the container, super convenient
wait wdym?
oh does ptero show all files in the machine/container?
like if i have an mc server in ptero
it shows the docker volume that it is attached to, yes
oh
docker has very much revolutionized devops and deployment of applications
you can automate deployment really easily by just rebuilding the docker container and booting that bad boy up
and kubernetes takes that to the logical extreme, you define some goals and give it a docker to run containers on and it'll make and destroy containers for you automatically
how come you wouldn't just leave the container up running?
online I'm seeing examples such as mysql and nginx, but shouldn't you just leave those on all the time on one machine?
well sure, those are a great example of a persistent service
oh
but, say for instance, you have a custom web app
like at my work
whenever someone merges a PR, it runs all the validations, takes down one of the two versions of our web server, applies the update, brings it back up, takes the other one down, applies the update, and brings that one back up
so we have no downtime while deploying updates
and just updates in general for anything you're running
for instance, on my Ptero server, I run a Prometheus and Grafana setup
oh and the github repo would have the docker config stuff?
or does it just update the files on the docker container
whenever I need to change one of the base configs for them, or update them to a newer version, it's as easy as clicking reinstall and booting the container back up
no, the best part is that the servers themselves are stateless
they maintain no state themselves, so killing them affects nothing
stateless? 👀
stateless 😌
wait what
they just read from the database on AWS and get static files from S3
so if we wanted, and needed to, we could have 50 of the web app running at once
o
and it makes development a breeze
I can spin up my own copy of the web app on my machine in about 10 seconds
just git pull, and run docker-compose up
docker is literally the biggest thing to happen to devops in its entire lifetime basically
it allows us to abstract away the actual implementation like never before
Works on my machine… taken to the next level
I mean yeah, it is literally guaranteed to
👍
ty for the explanations :D
yeah lol, i literally won't use an application if I can't do it through docker anymore
docker sexy
Why do I have a strong feeling that request paid is a scwam
I thought you were better than that terfs!
Yeah I’ve slowly eased my way in and I can see the appeal, I haven’t used it mine production myself, but in dev it’s been amazing to not clutter my machine
it just makes it so easy to have confidence that a deployment will work
docker is amazing if only used solely as a tool to reproduce pip environments
those things are fucking dog
Yeah, eventually I'd like to migrate to using it fully, especially these days with all the dependencies required
And migrations to new machines seem a breeze
yeah dude
literally just copy paste bam
especially if your container is stateless
holy shit it's the best thing in the world
deploy a container anywhere, connect to S3 and Aurora, bam you're set
Yeah it looks so cool, I think these days you have so many configuration for like databases, and shit
it gets a mess doing that repeatedly
have been getting this failed to add pdh counter error for my mc servers
please help
[20:31:38] [ServerMain/WARN]: Failed to add PDH Counter: \Paging File(_Total)\% Usage, Error code: 0xC0000BB8
[20:31:38] [ServerMain/WARN]: Failed to add counter for PDH counter: \Paging File(_Total)\% Usage
[20:31:38] [ServerMain/WARN]: Disabling further attempts to query Paging File.
what the fuck does that mean lmao
I cant even accept eula for my 1.18 mc server
this stupid error wont get off
it just keeps popping up right after bundles are unpacked
please helpppp
I dont need this stupid pdh counter
try setting your language to english
mojang bug report says it happens when you're using non-english language
also for each app?
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
ok so related to spigot plugin to prevent crafting of specific item - golden apple
i get:
Could not pass event PrepareItemCraftEvent to Plugin v1.0.0
org.bukkit.event.EventException: null
Caused by: java.lang.ClassCastException: org.bukkit.event.inventory.PrepareItemCraftEvent cannot be cast to org.bukkit.entity.Player
my code: https://paste.helpch.at/timamuxiwa.cs
Thank you to every in advance
EDIT:
solved
((Player) event)
where else do i need to do that?
oh
i need to do it for event?
Online Courses:
Online courses are also great for learning java. Some websites that offer them are:
- Coursera - Free unless you want a certificate
- PluralSight - Great courses from what I've seen. Mostly Paid
- Udemy - Never used them myself but they seem to all or at least most be paid.
My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.
Oracle Docs:
Oracle docs can help a lot at learning and understanding java:
- Start with this,
- Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
- Hit this.
They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff
Other services:
Some other cool services that will help you learn java are:
As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!
You are now doing it for the event
do it for the player
ok i managed to do it and thank you
change ((Player) event).getPlayer() to (Player) event.getPlayer()
tho it doesnt look like there is a getPlayer method
Casting player to player 
And yeah that event doesn't give you the player, it gives you the viewers of the inventory which will be HumanEntity
yeah sorry i managed to do it
i'll do this to my post
any idea why IJ doesn't work properly?? main is just a folder
right click it and there's a button to mark it as the main module or something like that
I SEE
kek
boolean a = true;
boolean b = !a;
compiles to boolean b = a ? false : true 😵💫
you see, it's not
but the jvm has no specific instructions for booleans
so it compiles to a branch lmao
awe jeez that sucks for performance
though the jit will 100% optimize that away somehow lol
jvm jit is jvm jit after all
There are even more specific interpreter instructions that will be used before any proper optimizations are applied. Not sure if stuff like that is replaced there already, but might be a candidate
pRoFeSiOnAl


I don't even know what it was doing, I have 24 threads in this cpu and it still ate that much
Looks like me trying to open the material enum
That's normally what would happen but I was just selecting some text lol
must have been some incredibly heavy text
it's back down to >1% cpu and 3.5gb of ram
cpu usage is normally fine, just the ram consumption is insane
who knows what kind of wizardry it's storing in all that ram
what'd he do
Man single handedly fucked the entire plugin
well that doesn't sound good
It was a hella good plugin, and now this shit, dissapointment intensifies
@hot hull Why did you resign from support position?
Which plugin 
sgp
millions of indices lol
whats better:
Intel Xeon E3 1230 V3 32gb for $49 a month
or we can do a ryzen 5600x 64 gb for 99 a month
or we can do an i9 9900k 64gb for 115 a month
ryzen between intel and amd
ok thanks for your help
also the xeon would be pretty shit as servers require better single core performance rather than more cores
are we looking at the same page?
?
basically the only difference is value, and they're nearly at the same price lol
wow 5% and 4%
well within the margin of error, and user benchmark is not a pinnacle of quality either
idk, that's what i would choose anyway and it's 15$ cheaper per month
i wouldn't choose it if adequate cooling was given and I needed those higher clock speeds
You're very quick
has it been a year yet?
2 more months
where is the channel to ask stuff about spigot plugins?
what?
y'know he doesn't respond to me any faster than you.
Man cucked the entire plugin
what plugin
sgp
what happened
It doesnt accept frosty's config for 1.2.5 made in 2012 smh
Pretty much yea lmao
its possible hook placeholderapi to php?
I don't think even probably would work...he can do is add the required placeholder to database... or open something like an API
with database maybe (?)
that can be done...
alright ty :>
most prolly display stats on webpage or use it there
yea
yeah placeholderapi is not designed for that
https://www.spigotmc.org/resources/redis-mysql-mongodb-papi-bridge-1-8-1-18-new-redis-support.80460/
Check out this plugin...its not of php, but works simillar like with the database
alright, ty
I swear- if you're complaining about your wacky pages.... go fix. 🙂
Had to make a custom plugin which bypasses sgps menu click cause it doesn't want to execute a blank action properly
What's the issue with your config anyway?
Config is just fine, just blank actions don't want to work
black actions?
blank
I don't get what you mean by blank actions.
As in you click and it does nothing, now it always opens the buy item menu
use the dummy item type
@hot hull use a dummy item like Blitz said
Here is an example;
1:
type: dummy
item:
# usual item stuff
slot: 1
You're a dummy
true
@cursive jolt quick question, does PacketEvents have a wrapper for the EntityPosition packet? i cannot seem to find it
Yes
where is it located? im apparently too dumb to figure it out
Check NPCManager
kinda wish that spigot events had an undo method rather than the whole setCancelled thing
would make async stuff in events a lot easier
rather than just "pray that its in cache"
unless anyone knows a better solution
yeah
player places block
Lookup location from database async
If location is protected, undo the place
Well you shouldn't need to fetch, it should be cached
In chunk load or whatever
Or maybe during player move and load data from surrounding chunks when they cross one
Idk
But there are so many things that can happen on block break, say you break a chest
A second later the action is undone
But the player has all the items etc
gg
Anyone know a python dev that can work with telegram api?
probably like, most people who can use python
im sure the telegram api ain't half bad
is it that earlier task?
ok so for InventoryClickEvent
there is this getTitle() method which is depricated.
i searched for other methods from 1.18.1 for InventoryClickEvent event but i can't find what i need
any thoughts? https://prnt.sc/jfUaplCk1wcv
(tag me when you answer)
- dont use title, use inventory holder
- getTitle exists, inside getView
- read number 1
so getInventory().getTitle()?
but it says it's depricated
and i am trying to do this in 1.16.5
but will need this for 1.17 (where maybe getTitle() doesn't exist)
ok, first
is not deprecated
- i said: getView getTitle, never said anything about getInventory getTitle
- Use inventory holders, not title
ok then, i thought this doesn't exist in 1.17+ (and i checked, however i didn't use search option but CTRL+F at InventoryClickEvent docs)
getView().getTitle() worked, thanks
yeah it works
still, you should never check inventory title
use inventory holders, as most people do
i never used inventory holders, will check out later
title can be faked, not a good option
additionally, inventory holder is 100 times better as you can "track" (save) data in it
to use them as you wish instead of relying on title
anad hashmaps to store dynamic data

ok i will check it out
besides that, i understand that it's better, are there any performance differences aside that you said (between this and inventory holders)
Are you using paper api?
no
i'm porting my old plugin to 1.16+
Or even better, make a list of players that are in your inv
InvHolder wasnt meant for these actions as a bukkit dev stated
@zinc basin accept my friend request
share post 
still better than checking title, imo
imma looking for some package which will check two strings russia.com and soviet.org for example, and will return the value in percentage of how much they are same
For javascript expansion
#general-plugins / #general-plugins-2
and send server log
?startuplog
Startup Log Location
Your latest startup log can be found in the logs folder of your
server directory, labeled as latest.log.
Please copy the contents and paste them to a paste service.
Type ?paste for more information.
i open my plugin workspace, then im like nah i cant be bothered then i close it and go watch youtube.
does anyone else do this?
Ofc
its the story of my life at this point
Yep, its called procrastination 😂
wish i could stop doing that and just get this mmo done
Best thing is just get started, dont think about it
and break it up into small chunks
Like rn I'm building a tagging system for grouped analytics, seems complicated, but when you split it up, it seems easier
We do a little decomposition
We do a little functional composition
im currently working on skills, judt gotta figure out how to implement skills
like they arent that difficult really
You use SkillShare. (Yes I am sponsored)
not them sort of skills lol
Someone please save me. Is Vysor something I should use to access my phone screen (that has the display broken) from my pc or is it a virus? bcz youtube removed dislikes...
found some 2018 comments saying its ok. but we're 4 years later now
how anyone know how to add CanDestroy tag to an item using NBTAPI? it's a list
Can someone explain me why this isn't functional
var VaultRank = '%vault_rank%';
function getVaultRank() {
if (VaultRank == "default") return "hasdefault";
else if (VaultRank == "iron") return "hasiron";
else if (VaultRank == "gold") return "hasgold";
else if (VaultRank == "diamond") return "hasdiamond";
else if (VaultRank == "emerald") return "hasemerald";
else if (VaultRank == "ruby") return "hasruby";
else return VaultRank;
}
getVaultRank();
Suppose thats using PAPI
Are you parsing it?
Also, why dont you just hook to vaultapi?
also switch statement
And that
you need to optimize js code as much as possible because papi js uses a lot of resources
a ton more compared to a java papi extension
Ye
also you can use papi expansion changeoutput probably
try and see if it fits your needs
@fickle tusk
I'm by no means an expert within any coding language I just know bare basics, I don't know why it wasn't working. All I did was change the file name from shardsfix.js to shardfix.js And now the placeholder is parsed correctly.
Besides that about the resources how much is it and does it really affect me?
I don't code or anything nor do I know how that would work.
i have been using a "compass" like placeholder that was being updated constantly in a bossbar, can't remember the exact amount of resources that TAB was reporting that the placeholder was using, but it was 10's of times better after i made a java expansion for that
and it was basically the same thing, checking yaw of player and returning a special character that was a texture in my texture pack
None of my js placeholders update constantly
only when requested which is like once every long time e.g. this is for whenever users want to buy items within a GUI
this is intended behaviour, papi does not work like that sadly
I don't understand the switch thing i'll just stick with what I have as it's not causing issues
can an output have multiple options ?
view_requirement:
requirements:
anythinghere:
type: string equals
input: '%vault_group%'
output: 'gold + diamond + emerald + ruby'
no, it will expect your output to be literally that
someonr said js expansion was slow (i mean when using it)
related to events
is event.setCancelled(true) the same as return?
https://prnt.sc/KwC1ERkrlKPZ
i have this problem
for ChunkUnloadEvent event
ChunkUnload is not cancellable
return is just return from your listener function, changing the cancellation state (for cancellable events) just "marks" the event to prevent it from happening on the server
this was present in 1.12-
ok i hate this api changes
i never used to create 1.13+ plugins
Well something changed in the game that made unloading chunks not being a preventable action
You should use plugin tickets
wdym?
If you want a chunk to be loaded you should add to the chunk a plugin ticket, it's now the supported way to not unload chunks
Search in the javadoc for "ticket"
ok so basically i check for specific mob if it's at chunk (for each custom mob) and if yes don't unload that chunk
so that's why i used event.setCancelled()
however i see now this isn't supported anymore
okay
Lol
I HATE THIS CLASS
bad pc
"the ide is running low on memory" it has 3GBs ffs
what you doing with oraxen
🙈
Make it 128GB and it will only take 5 minutes
🤣
I second this
Give it 6GB!
lol what are you trying to do with oraxen
Up it to 4, I believe that’s what mines set at, or 6, and it’s smooth
ezrankspro plz anyone
how much ram i need for a base 1.18.1 server with 25 plugins btw
i have 8gb they tell me my memory is low sounds like BS
oh so having jetbrains runtime set as your JDK on the project doesnt support removing methods in debug IJ? funny
thought it had DCEVM on it
[08:45:29 ERROR]: Username 'Vreeens' tried to join with an invalid session
how to fix it
Not sure whether this is the right channel for this, but I think this is caused by the fact you have an online mode server, and the player is trying to connect with a cracked acc
Who haves coinflip plugin?😀
anyone know if its possible to display item/armor durability on the scoreboard?
Player#getEquipment()#getHelmet()#getDurability() ?
why look at docs when you can ask here and waste more of your time waiting?
right, my bad 
Makes sense
It has , instead of .
i dunno man, js always has a fucked up trick under its sleeve
It's NaN
So... what would it do with 100,000,8?
8?
Hello! How can I replace all colorcodes with ChatColor codes? For example:
&c is ChatColor.RED
Do I really need to replace manually?
ChatColor#replaceAlternativeColorCodes
yeah that's the one
Yeap, thanks :)
ChatColor.translateAlternateColorCodes('&',somestring)
yes
Consider using Adventure
Trust me, once you start using it, you won't go back.
Whats that
A library to make sending messages to players easier
https://docs.adventure.kyori.net/
LMAO

laughing at a deleted message
I agree with your message
I wasnt paying attention and said something that was already recommended
Dark mode task manager on next win11 update 
Hey! I'm trying to find already spawned entities when they are being loaded with chunk.
ChunkLoadEvent has getChunk().getEntities, but it's empty, doesn't list any entities...
How can I get entities that are already spawned? Is there any entity load event?
Add a delay.
But how much? I see that they are loaded async, but time always varies.
There's really no entity load event I could use?
EntitySpawnEvent?
That's spawn, not load
Entity is already spawned and being loaded from unloaded chunk.
Then yeah just add a 1 tick delay. Entities aren't spawned async. They literally can't be xD
Will try - thank you!
As for async, I read it from here, that's why I thought it's async:
https://hub.spigotmc.org/jira/browse/SPIGOT-6572?focusedCommentId=39302&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-39302
EntitiesLoadEvent was apparently added.
What the... Google is piece of sh*t, didn't come up with searches like "spigot entity load event"
Thank you!!!
np
When compiling plugin in gradle/jar it compiles but when I drop it in plugins directory in server it says that it don't have plugin.yml when it is located in src/main/resources
Windows detected
Opinion rejected 😎
Are you using shadowJar?
It won't put your resources in unless you are
I was using jar thanks for knowing
This is so weird, entity.getName() is the same as entity.getCustomName(), when custom name is set.
Anyone knows how to get entity initial name? That's being set by the server, can't be changed?
What even is the initial name? Like Cow?
Yes
When I used ShadowJar it still dont appers https://imgur.com/8dnpGWe
Uh, maybe you can access the translations? and then convert the EntityType enum to a name?
That's the thing, can't use entity type, because one type can have different names.
How is your project setup? Is it using the correct package hierarchy?
For example: TROPICAL_FISH can be Triggerfish, Cichlid, etc...
oh man I have no idea
maybe a Fish has what type it is?
ah yeah TropicalFish#getPattern()
Huh, that's kind of sloppy way... I still can't understand why getName() changes, when setting setCustomName... what's the point of custom name if it changes getName...
oh weird, so getName is from CommandSender
and getCustomName and setCustomName are from Nameable
I don't think there even is a default "name", just that getName from CommandSender happens to give you the i18n entity name for whatever entity it is
onEntitiesLoadEvent() entity.getName(): Creeper lvl 1 ; entity.getCustomName(): Creeper lvl 1
Literally the same... damn shame. I'll try to temporarily "null" custom name and let's see what happens to the getName then.
Pretty sure it just calls getCustomName under the hood
ah no, they both call the NBT name
Its code from github, which is normally working plugin so I think it have correct package hierarchy
and you're running gradle shadowJar and it just gives you an empty jar with only a META-INF?
Well, nulling setCustomNake works, I can get the initial name with that.
Where did you see that they both call NBT name? Maybe I can get "raw" initial name somewhere by reading some other NBT tag?
Because initial name is being set after setting setCustomName(null):
1onEntitiesLoadEvent() entity.getName(): Creeper lvl 1 ; entity.getCustomName(): Creeper lvl 1
2onEntitiesLoadEvent() entity.getName(): Creeper ; entity.getCustomName(): null
Yeah
Then either the build script isn't right, or you're not calling it right
Tbh I was just skimming spigot patches, I am now whipping out my full Paper patched build to check lol
public void setCustomName(@Nullable Component name) {
this.entityData.set(Entity.DATA_CUSTOM_NAME, Optional.ofNullable(name));
}
@Nullable
@Override
public Component getCustomName() {
return (Component) ((Optional) this.entityData.get(Entity.DATA_CUSTOM_NAME)).orElse((Object) null);
}
That's the code straight from Paper
@Override
public Component getName() {
Component ichatbasecomponent = this.getCustomName();
return ichatbasecomponent != null ? Entity.removeAction(ichatbasecomponent) : this.getTypeName();
}
aha!
@marble plaza there it is
I should call it from gradle and then shadow/shadowJar ?
What plugin is this? It might have a custom build script that you need more than just shadowJar
So basically it's still getTypeName, so called initial name.
I'll check how it responds to different type of fishes.
Thank you for helping me! Really good help!
Yeah, I don't know if you can access that exact method from a plugin, as it is part of NMS, not the bukkit API. The only usage I could find for it is in that method that I sent.
So I guess you have to set the customname to null to get access to that name, unless you break into NMS lol
Setting null seems easier :D Thanks once again :)
Okay so, I built it, you have to go into the plugin/build/libs folder to get the jar
the top level one isn't the actual plugin
Thanks a lot ❤️
Hey! I'm trying to create BungeeCord plugin, but can't figure out how to determine if command was executed from Bungeecord console or not.
Spigot has:
if (sender instanceof ConsoleCommandSender)
What about Bungeecord?
Hello everyone! How would I make a compass pointer spin in spigot coding?
I'll be a little more specific. I have gotten the compass to point to players but when there are no players online it still points to the last point the player was at. I want it to spin instead of pointing to the ghost of a player who once joined.
i think the compass spins when you are on top of the location
so if I make the compass target location the player, then it will spin?
not the player itself but its location
lol, I can't believe I haven't tried that, ill give it a shot
yeah ik the player.getlocation
👍
that doesn't work 😭
I can say that although copilot is cool and gives good suggestions
it can be annoying
really annoying
Idea keeps asking me to convert my classes to records :/. LET ME KEEP MY PRIVATE FIELDS VIA DI PRIVATE, INSTEAD OF MAKING MY CLASS A RECORD
💀
you can turn off inspections like that
or lower their priority so it won't underline
Hi, there is a warning in my plugin when the server starts: https://paste.helpch.at/fuwuqaximu.sql
But this error does not affect the work of the plugin, I would like to know what this error is about and how to remove the warning
In AJoinerPlugin#onEnable, you execute a query with MySQL, what does that look like?
Because I think you're supposed to do ResultSet.next() or something to get the first part of the ResultSet
here is my OnEnable
https://paste.helpch.at/emayizoyoq.coffeescript
and (MysqlExecutor.java:67) result.set(handler.handleResponse(mysqlStatement.getResultSet()));
oh yeah so
you need to do ResultSet.next()
cause the pointer that resultset gives you
is before the database
then you have to do next to go to the first row
you can change the inspection to only warn you if visibility wouldn't change
How can I get a <version>1.0.0</version> into sendMessage ?
what
Yes i did everything specified in the website. I used With a plugin Internal class one
It is registered also
But when i try to parse it, It wont work
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
and doing /papi parse me %example_hello% doesn't return anything?
np

Hello, with deluxemenu. I can't create a command that opens a menu to ban a player example: /ss <player>
It tells me that the command does not exist? do you have any idea please?
@obtuse gale I can do your luckperms
open your dms
guys
yeah?
No working
CustomModelData
In config. Pls fix.
1.18.2 version
no working nbt_int: CustomModelData:1
no showing.
what? what plugin are you talking about?
They prob mean DeluxeMenus
Has anyone used https://gameanalytics.com/docs/s/article/Collection-API before? I have trouble using https://gameanalytics.com/docs/s/article/Collection-API#Init-RemoteConfigs
I get 401 unauthorized with this code https://paste.helpch.at/sinijamupa.java
@neon crater 🤓
😂
for minecraft plugins,
if (cmd.getName().equalsIgnoreCase("start")) {
player.sendMessage("Starting in 3");
//delay 1 sec
player.sendMessage("Starting in 2");
//delay 1 sec
player.sendMessage("Starting in 1");
//other command...
}```
is there any simple delay code? i tried .scheduleSyncDelayedTask and other thing but have many problem, im new at this
thanks for answer,
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.function.Consumer;
public class CountDown implements Runnable {
private JavaPlugin plugin;
private Integer assignedTaskId;
private int seconds;
private int secondsLeft;
private Consumer<CountDown> everySecond;
private Runnable beforeTimer;
private Runnable afterTimer;
public CountDown(JavaPlugin plugin, int seconds,
Runnable beforeTimer, Runnable afterTimer,
Consumer<CountDown> everySecond) {
this.plugin = plugin;
this.seconds = seconds;
this.secondsLeft = seconds;
this.beforeTimer = beforeTimer;
this.afterTimer = afterTimer;
this.everySecond = everySecond;
}
@Override
public void run() {
if (secondsLeft < 1) {
afterTimer.run();
if (assignedTaskId != null) Bukkit.getScheduler().cancelTask(assignedTaskId);
return;
}
if (secondsLeft == seconds) beforeTimer.run();
everySecond.accept(this);
secondsLeft--;
}
public int getTotalSeconds() {
return seconds;
}
public int getSecondsLeft() {
return secondsLeft;
}
public void scheduleTimer() {
this.assignedTaskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, this, 0L, 20L);
}
}```
i copy one of the best answer from that thread, but i confused how to use it?
Looks like you make an instance of the object and run scheduleTimer on it
sry im new, still didn't get it
for example
player.sendMessage("Starting in 3");
//delay 1 sec
player.sendMessage("Starting in 2");
//delay 1 sec
player.sendMessage("Starting in 1");
how to make the instance of the object to run scheduleTimer ?
do you see the constructor?
you give it what it needs
so an instance of your main plugin, the seconds it will take, a runnable to run before the timer, a runnable to run when the timer is done, and a lambda that takes a CountDown object and does something every second
Man it's been so long since I was here that I actually understand the code now 😭
when you go from being bullied to being the bully in helpchat 
no I was 100% the bully 4 years ago as well
welp
Ayy 3 years running
man 2020 is my favourite. I am so sad that I Didn't participate
I want mine 
😦
Still not got it?!
Wtf
I remember a few weeks ago you mentioned it was in limbo
yeah. pretty sure its lost
hi, i have a lil problem as a new
inside alpha.java file :
public void example(final Player player) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
player.sendMessage("message here");
}
}, 20L);
}```
inside beta.java file :
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] a) {
if (sender instanceof Player && cmd.getName().equalsIgnoreCase("test")) {
Player player = (Player) sender;
example(player);
}
return false;
}
i want run example(player) in beta.java from alpha.java, how to connnect it?
import it
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
the class isn't called beta
and you didn't put a semicolon
and you should be capitalizing your classes
2nd year for me sadge
oh really aha
https://paste.helpch.at/xihuledare.java
still didn't work, it says
Cannot resolve method 'EXAMPLE' in 'APLHA':14
i put semicolon, forget to write it
You can't call a method of another class without have an object of that class.... also follow Java Naming Conventions
static 🥴
that could very well be a static utility method tbh
he didn't import it as static
public void EXAMPLE(final Player player) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
player.sendMessage("message here");
}
}, 20L);
}
correct me if i am wrong?
it isn't static right?
oo..okay...mb...you meant that he can call without the object as making static ?
umm so how to make it static?
😂
public static void EXAMPLE(final Player player)
public static void example(final Player player) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
player.sendMessage("message here");
}
}, 20L);
}
don't case those please
not sure what this sentence means
i literally copied your example lmao
nah...nvm...it would get weirder if I tried to explain it... 😅
Ig, he would copy the exact line...
i mean, you did it first is my point lmao
btw, which IDE you use?
he didn't import it as static
this doesn't mean what you think it does
what is IDE? 
oh jeez lol
My brain isn't been able to process it 😅
perfect! I expected it
told ya im new 
So what software you write these codes?
IntelliJ IDEA 2021.3.2
And thats an example of IDE
ooo i see, btw
'com.vanezzz.countdown.BETA.this' cannot be referenced from a static context
oh I forgot that was your main class
yeah put that in a separate file and pass in a reference to your main class
that would be too complicated for him to understand...IG
lemme try
ah i give up, ill just put it all in my main file
thanks guys for helping
https://paste.helpch.at/ihisirunuz.java
its can be something like this....
Also i hope you are registering those commands too
@desert horizon you're the github guy. in an issue or a response to an issue is there a fast way to mention a commit same way you'd do with a PR? #24 for example?
Can't you just link the commit number?
Post the Commit URL or the hash itself. First 7 characters would be enough for that
oh interesting
thanks
https://www.andre601.ch/GitHub-Markdown/ this is nice ngl. gonna save this
Yeah. GitHub didn't had a good Markdown page, so I went with making my own, especially since some features aren't documented yet
Hey, any1 know a way to convert DocX to PDF without having to pay for it? (Java)
pay for what? try this maybe: https://stackoverflow.com/a/43371408
well everything I found used libraries like aspose or something like that which costs money
but I will give this a shot
Apache poi is nice
hi, im making 2 file, main.java and alpha.java
main.java extend JavaPlugin
but alpha.java also need extend JavaPlugin, because i run .scheduleSyncDelayedTask on that
i tried put this inside alpha.java
private Plugin plugin;
public alpha(Plugin plugin) {
this.plugin = plugin;
}```
but still show Cannot resolve method `'scheduleSyncDelayedTask(com.vanezzz.ngckevent.alpha, anonymous java.lang.Runnable, long)' `
Show your task
uhm what's the difference between p.getInventory() and p.getOpenInventory()? AKA what's the difference between playerinventory and inventoryview
getInventoryView? is this a player method? bcz I can't find it. Do you mean getOpenInventory?
fk ye
misread it
mb
it returns an inventoryview and my brain died lol
anyways yes, getOpenInventory.
Pretty sure PlayerInventory just refers to the actual player inventory.
but an InventoryView gets both inventories a player might have open. the top and bottom one.
hmm okay thx
trying to see how I will do an invsee command
sounds easier than understood lol
I am actually confused how I will make it work and be able to even edit it in real time lol
at the end it's probably easy af and I am just quite dumb
damn that's so clean
thank 
Would be prettier in kotlin 😩
lulw
hey is anyone here actual discord staff
@compact perch are you a discord staff by any chance?
no
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
perhaps use a custom thread pool but very pog (I assume its alr thread safe :3)
perhaps
ive spent
5 hours on this fucking recode
to realise it doesn't work
and i had to restart

ive been doing this since 2pm, its now 9:40pm
what didn't work with the previous recode?
uh
everything
the command system completely flunked on me, the entire config system created to allow comments just worked exactly the same
everythin just fell apart
so im just gonna use the same library rosewood plugins use because its less work for me
people need to seriously learn to read before clicking links
Are there any downsides for using plugman to test my plugins?
yes, plugman should be avoided
you could look into hotswap if you want a quick reload, it works in most of the cases
read here if you want to know why you shouldn't do it: https://madelinemiller.dev/blog/problem-with-reload/
Only ever use /reload on a dev/testing environment
and even then, only really for config files
Thanks everyone!
Hey I am trying to convert a groovy Transformer to Gradle KTS, I am struggling at this part:
def lines = context.is.readLines()
lines.eachWithIndex { String line, int i ->
def replacement = lines[i].replace("language1", "language" + matchCount)
lines[i] = replacement
result.append(replacement + "\n")
}``` there is no readLines in kts
does anyone know an alternative?
What is context?
TransformerContext
For most basic plugins, shouldn't affect (i mean for testing)
i rather using /reload instead
Where is that from? I need more 
all good I just found a solution, it was pretty easy actually
Oh nice nice
Gotta love these request paids where they don't even say what they need
Doesn't two of the requests not follow the key points from yesterday (with the infinitely expandable budgets)
I just told someone that lol. Their response was along the lines of "If they don't take time to message me their lazy and I won't work with them"
Absolute tards
how to disable break for specific block? like only grass block
List<Player> blockbroke = new ArrayList<Player>();
public void onBlockBreak(BlockBreakEvent event) {
Player p = event.getPlayer();
if(blockbroke.contains(p)) {
event.setCancelled(true);
p.sendMessage("You can't break a block!");
}
}```
btw i already asked this question from a plugin dev but
can making minecraft plugins help increase my proficiency in java coding?
I mean, sure, if you do things right
There are people who have been doing plugin development for ages and still write truly horrendous code
ooooo
next question, will my knowledge in java eventually expand while making minecraft plugins? (assuming i will eventually attempt to create more complicated plugins)
Uh. Your knowledge in java will expand sure. But there are things you may never learn in Java while using Bukkit/Spigot/Paper API.
You don't usually use the full extent and capabilities of java while coding minecraft plugins.
It's a good way to start with java in my opinion, but if you want to expand knowledge, you need to go outside Minecraft in my opinion.
But you will probably learn most of the things you need in Minecraft just fine. I would say it highly depends on how much you wanna know.
Adding to this, I would say a good way of preventing this is doing things outside of our knowledge scope and try to improve it. One way I am currently doing it (since I am not really an expert in java and maybe not even "decent") is that I actually study theory of Java, I see examples of how code would work, I check resources explaining different methods of achieving something and read a lot about best practices.
Odd request, but is it possible to be able to get a string with the color codes, without it translating?
I'm trying to log out a placeholder api placeholder (from deluxetags), I need to see the string with the colours, but without them being replaced
Is this possible somehow?
you can send the string to console
ah well, papi replaces colors by default I believe
can this be turned off somehow?
if that makes sense
I dont think so
what's ChatColor.values(String) for?
d;spigot chatcolor#values
haha
public static ChatColor[] values()```
Returns an array containing the constants of this enum type, in the order they are declared.
an array containing the constants of this enum type, in the order they are declared
Hello, iam currently programming a Spigot Plugin (for 1.18.1) and iam looking for a bukkit listener event when a player steps in water :D
wut
d;bungee-chat ChatColor
public final class ChatColor
extends Object```
ChatColor has 25 fields, 13 methods, and 1 extensions.
Simplistic enumeration of all supported color values for chat.
4head
can pls someone help me :)
you literally find the answer on google in 2s .-.
I can't use hex deluxetags with minimessage
screws me over because of papi translation
no i dont :(
https://www.spigotmc.org/threads/detecting-player-on-block.114910/ maybe this helps
thx
can't you hook into deluxetags?
instead of using papi
pretty sure that's deluxetags. it parses hex colors before returning the placeholder.
oh really..
oof
and its from a configurable string
yeah. I was thinking of adding a raw placeholder
yes please
when I get to it xD
because its caused me non stop grief 😂
but for you that's in a few minutes
Because if I give it the string raw, it parses fine
but papi parsing with dtags causes that shit
and hahahaha godsend, ty <3
pretty sure papi only parses the colors using the ChatColor#translateAlternativeColorCode method. not hex.
which is also a bug I believe which is hopefully going to be fixed one day
you're joking?
no
fuck
also. I just realised I fucked up. it will take a few more minutes to send you a build
F
if this works, im speechless, because ive been completely baffled on rhis
Why do I have the feeling I will die 5x while trying to recreate invsee++ in my plugin
Whatever
do you want raw placeholders for every existing placeholder or just for the current tag? aka %deluxetags_raw_tag_<id>% ?
yea yeah. no id. my bad
lit ty
Try this
Charlie leaking shit I see
dodgy
It shows that for every download now
ye ik ahah
I've adapted already lol. its like it doesn't exist
Can you even disable it?
don't think so
yeah. that's PAPI
no problem
finally
ye lol
are me
You wish I was
Is a joke before you start throwing tea at me
I know aha
Progress?
Omggg you’re making a pet plugin?!
Just making custom pet models and shit
Ohhh
Animations and everything
There is no time to wait! Ask your question @lethal parrot!
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Material material = player.getLocation().getBlock(); <-----------
if(material == Material.WATER) {
event.getPlayer().setHealth(0.0D);
}
}
Does anyone know why iam getting "Incompatible types. Found: 'org.bukkit.block.Block', required: 'org.bukkit.Material'" Error in the marked line ?
no
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
?
You need to change it to Block
then it says: Operator '==' cannot be applied to 'org.bukkit.block.Block', 'org.bukkit.Material'
alright thanks
where should i ask for help ? because my discord account got hacked
this is my alternative
Material material = player.getLocation().getBlock().getType();
it also worked with if(material.equals(Material.WATER) {
But aren't you getting a block?
idk
How would that equal Material.WATER?
ill try your solution
thanks
Material material = player.getLocation().getBlock(); doesn't this get a red line or something?
getBlock should return a Block and not a Material?
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Material material = player.getLocation().getBlock().getType();
if(material.equals(Material.WATER)) {
event.getPlayer().setHealth(0.0D);
}
}
now i have it so
yep
it works :) my first program :D
nice
is it difficult to set up an plugin.yml file to easyly change and customise the plugin ?
you mean config.yml, not plugin.yml
yes xD
Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage("this is nether"));
how to make this code only send to player in world "nether"?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thanks so much for your help :D @hazy widget
for(Player pl : Bukkit.getOnlinePlayers()){
if(pl.getWorld().getName().equals("nether"))
player.sendMessage("this is nether")
}
else you can use streams...but I prefer those iterators over lambdas...
thanks!
i forgot one..in the loop
yeah
just typed out from here
isn't forEach the same thing as for (object obj : list)?
not related to anything above, just curious
Yes
Yes..but i heard that lambdas are slower than iterators...so I usually prefer iterators...
how can i use a variable from the main class in another package ?
reference the main class into the class or use static
it's pretty negligible in most circumstances
Iirc forEach gets inlined
If not the difference would be almost non existent to the point that sometimes lambda is faster
Yeah...I too guess that...I don't know the authenticity nor got the time to test it out myself
it should be a single lined code to get inlined right? or is that a concept in C only?
inlining happens at runtime
the JVM compiles the code into native and applies a ton of optimisations if a bit of code is used frequently enough
im still surprised at sequences not being faster
i am surprised kotlin is much faster xD
Sequences only lost to streams in one test BM
okay...then forgive me xD
yea but they're not really comparable, sequences are branded as an alternative to collection operations
The main point of streams is parallel processing, the nicer code is a bit of an afterthought
Also "lambda are slow" is like saying "calling methods is slow so I just have the entire program in a single function"
You're not gonna get any, and I do mean any significant amount of performance increase by doing that
Yeah, lambdas are quite fast
If you have the right type tokens a lambda is faster than reflection's invoke
The jvm is surprisingly well optimized
Don't diss the jvm
Although idk if I should be compiling functions in elara to methods or lambda variables
Can see the benefits of both
but i think lambdas everywhere might not be great for performance
i still dont know how to do this :/
you need an instance of the class
i.e an object
or make it static but thats probably not a good thing to do
and how do i do this ?
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
i did read this, but i dont know how to do it
i mean that's pretty much it lol
if Other needs a CoolPlugin, you put it in the constructor and then pass the instance
Or you use static 😍 jk
and then go to hell and die
so ill chage "public void" to static void ?
No I was only joking
NOOOOOOOOOOOOOOOOOOOo
What’s your code so far
NOAAAAAAAAa
how can i show it ?
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
Put your code into this
Your main class, and the other class you want to reference
how can i send it ?
Paste the link here
sowwy iam new here :P
So paste your code into the HelpChat paste link, and then click save
It’ll give you a link
And no worries :) we all start somewhere
So for clarification
I added
private Main plugin;
public WaterListener(Main plugin) {
this.plugin = plugin;
}
This passes your main class to your listener
Then added this to your
manager.registerEvents(new WaterListener(this), this);
This tells WaterListener what your main class instance is
Now you can use plugin.blah in your water listener
Hey...just something i saw on this.... you could always use getConfig() rather than calling file that way....
and i don't think the file would get called...
bcs..this isn't the full path plugins//WaterDeath//config.yml
and then i can use the "resetMessage" variable in the other package ?
Then you'd do plugin.getConfig().getString("ResetMessage");
in your water listener
first, i want to finish this problem :)
where exactly do i have to paste it in ?
where i am sending the message ?
ye in your water listener
like so ? https://paste.helpch.at/uqopuvukat.cs
Yep
public class WaterListener implements Listener {
private Main plugin;
public WaterListener(Main plugin) {
this.plugin = plugin;
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Material material = player.getLocation().getBlock().getType();
if(material.equals(Material.WATER) && (!player.isOp())) {
player.setHealth(0.0D);
player.sendMessage(plugin.getConfig().getString("ResetMessage"));
}
}
}
to tidy it
thank you :)
np :)
looking through some archives and i found the enterprise class name generator
omg
i forgot how to run it
=== 1 Enterprise-Ready Class Names ===
AbstractPredicateVisitorObjectListenerBoostrapCandiateExceptionAdapterBeanBoostrapAbstractMapperExceptionPoolInterpreterBoostrapResponseFactoryVisitorServiceAdvisor
========================================
``` there we go!
amazing
that sounds like something spring boot would have
exactly 
I recommend you pass the config rather than your main tho
Coupling won’t be as tight
i already did it :D but thanks for the suggestion
You passed main or just your config?
Anyone have any experiences with gitbook?
a bit
Is it worth using? Or is something else better
I find it good enough, like learning it doesn't take much time and then its pretty trivial and straightforward
yet it their themes and design looks clean and appealing to the user
Could anyone that knows how behavior packs work give me some advice and answer some of my questions in a vc? DM me if possible please
ive started to move away from strings to enums for my map identifiers
for stuff like enchants, skills, stats and items
which i believe is better for me atleast
what
so instead of <String,Enchant> im using <EnchantEnum,Enchant>
It just looks better personally
cause strings were a little difficult to keep track of
what is the value then?
so i dont have to forloop over it
what
id have to for loop over the set to figure out which object has the values im looking for
single lookup vs every entry till its found.
but what does single lookup do under the hood?
I have no idea





