#help-development
1 messages Ā· Page 308 of 1
now only wondering wtf this is
theres a class extending Node if that helps
and (Node[]) new Object[26]; works fine, tf java
its not even generic that class
oh well it compiles but causes a classcast ex
Just cast the Node[] to Node[]
Very weird one but... listener for if a certain chunk loads?
Certain chunk
ye just filter on it
Oh god duh haha
There a waynto get a definitive list of every chunk too then?
Basically gonna build this damn delete all the shit plugon and have it slowly and passively delete the shitnmoment a chunk loads and theb scratch that chunk off the list
working with an Object[] works but looks brr lol
wdym a definitive list?
of all chunks loaded?
Every chunk in the server files.
Once a chunk is loaded it..... omfg sorry I'm an idiot. I was gonna have a white list but in reality should be making a black list
So
-Chunk loads
-Checks every chest ,inv, shulker and furnace in the chunk
-deletes the item in question from each container-adds chunk to blacklist
uh go to all timestates
?
all the tilestates in the chunk
Ph yeah duh
Maybe haha
furnace and chests are in there
those should be inventoryholders too, which has a getInv method
hope you actually know how to implement it
I'd backup the world
And try to work with the files itself
It'll be more efficient
- no workload on your server
How would you even start with the file?
Good question
I wanna try to do it
reading abt it here rn
@livid dove what mc version u using?
there's this
the nms world after going to the nether still is the OW fsr
it's confusing
maybe I'll need to just delay the packet
Because when you change worlds, a new player instance is created
huh
A new EntityPlayer instance, that is
Oh wait no, I'm mixing it up. Nevermind. It's the same
oh
In vanilla it's a new EntityPlayer and we have a PR that restores that behaviour
Not sure why the world wouldn't update though
I'll try find a work around ig
or, find a way to fix it š
depends on how you are obtaining this information
if you are trying to do it right after they teleport you will still have the previous world since changing worlds is like spawning
got to wait a tick or a few
last time I tried that lib it didn't work at all
Hi im new to plugin making and im running into a few errors when I use intelliJ's minecraft plugin. When it auto made a class with "import org.bukkit.plugin.java.JavaPlugin;" i got an error saying "Cannot resolve symbol 'JavaPlugin'. i tried installing spigot and spigot api in library and as dependencies
Yep doesn't work
thanks! unfortunately i got this:
> Task :buildSpigot FAILED
It may take a while. To see build logs, start with the option '-d' or '--debug'.
Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
java version "17.0.5" 2022-10-18 LTS
Java(TM) SE Runtime Environment (build 17.0.5+9-LTS-191)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.5+9-LTS-191, mixed mode, sharing)
*** The version you have requested to build requires Java versions between [Java 8, Java 16], but you are using Java 17
*** Please rerun BuildTools using an appropriate Java version. For obvious reasons outdated MC versions do not support Java versions that did not exist at their release.
but mc 1.19 is java 17 right?
me? what --rev ?
what command did you run with buildtools?
intellij automated stuff
i cant send a pic
its like in the top right
im using this template from github
one of the files says "feat: add support for building jdk17 packages with jitpack"
can someone try helping me rq please
does anyone know a template for 1.19?
whats a template
You mean how to create a basic plugin?
yes
https://www.spigotmc.org/wiki/create-a-simple-command/ reading this rn
You have to verify with tour spigot account, and then You can send oictures
but doesnt even show me where to create the file
Haven't read the whole conversation, just wanted to add that I always successfully use this lib: https://github.com/tr7zw/Item-NBT-API
I mean, that is not from spigot api
It's not for use with a mc plugin
You must first learn how to code on Java and then You have to start working around with apis or libraries
š¤
Fourten
Answerin to that
huh wait
That si what i understand fron your text
alright here they show a pic of files in src/main/java but it never made me those https://www.spigotmc.org/wiki/build-you-spigot-plugin-with-gradle-groovy/
I'm trying to setup a claim system using GriefPrevention and the LP editor but im having trouble. Anyone able to help?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Gradle is just a dependency manager, i don't understand what You mean
no idea what you're talking about
Pierre, explain exactly what your question ir issue
I don't understand what You need exactly
i just want to set up a simple plugin with a single command
(for now)
Ok
What have so far
You told me You are using gradle to build your project
That is okay
ugh i cant send pics
You have ti verify using the ?verify command
i am trying
NewTo verify your discord account, please click this link.
Note that this cannot be undone!
just sends me this
WITHOUT A LINK
What?
on the spigot account
it bugged out
there was no link ....
You are already verified don't worry
what i have
(for context, i have experiences in other languages: Rust, python and C++, so imo im somehwat familiar with programming)
Oh ok
i'll just ignore it š
Yeah Java si pretty different how You create project
yea its really ugly and messy
Na it's okay
opinions differ, maybe i learn to like it š¤·
Resources folder is like the assets folder from websites
Main is like the src folder
yeah
It's the simple way for ezamplaning
So you have to code inside the folder Main/src
Have.you learnt Java itself before? Not wondering to sound rude, just to know how to explain some extra things
ehh wel
coding is general, but i havent really used java enough to be amature
How would you make an npc disappear from your world and tablist with NMS for 1.19.3? I created a ServerGamePacketListenerImpl to get the player connection and then tried to send an Update Packet: ServerGamePacketListenerImpl ps = getPlayerServerPlayer().connection; ps.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, npc)); But it is not doing anything. I also looked at https://wiki.vg/Protocol#Player_Info_Update and it showed "Actions bit 3: update listed" as a boolean but I don't know how to change it to false so that npc is not in tablist
but like i know theres gotta be a java thingy in java, with classes inside
Because from my personal experiences i would first learn the lang itself where i code. And then start trying to use libraries or apis
Because Java it's not diff to code on it, but have many basic things to learn
I would first look how Java lang works really abstract, to then understand better the coding
Because Java is "pretty weird" cuz it's a lang where he compile what You code to a low level called Bytecode and then the JVM interpret that Bytecode
i just wanna throw myself in the deep because i have 0 mood to relearn the basic stuff like for loops
i will come across those later anyway
So Java it's a compiled and interpreted lang
i know...
this is what i got
Ignore that
Just trying to remember the command name
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
That contains most of what You shouldn know
What IDE are You using?
i feel like there was still no proper / technical reason given in this thread
from a CS pov
š
Cs?
oh yeah no
i'm just talking abt the thread
dont worry
the thread looks like bs š
because there is no technical reason
im already following that tho...
the naming of the class means nothing past developers
yeah so therefore there's no actual reason why u shouldnt use Main
exactly
that thread shouldnt exist
its kinda bs š
why is it still showing those lines
dont indent
the only possible explanation is that Main should hold a JVM entry point, and because it doesnāt then you wouldnāt name it as such
but tbh you can change the entry point class anyways
the IDE actually did that lol
weird
I till don't understand what You mean by that replies to Main
That happen only using the Minecraft-Development plugin
Because he parse the plugin.ynl file shole You coding
Iāve never touched that plug-in and it happens to me
i was talking about the thread that got linked
not about u
itās just an IntelliJ thinking you are making a new config section when you enter without a value
in intellij im using minecraft development kit and when I start the servre with the plugin in it and do /plugins it doesn't show my plugin for some reason? anyone know why its my first time using intellij minecraft development plugin usually i just use maven
https://github.com/PierreV23/PLHide-Help
what should i do next to create a command? im pretty sure im missing some stuff in main/java tho
š
What i don't understand. I was looking for the command which sent You the basic plugin struxture. But i never find it
you have no resources folder
oh idk what command that is
therefore no plug-in.yml, unless you have special build instructions
I do
i was just ranting abt the thread
oh you do
under main?
sorry I was in the other dudes GitHub
whatās in it?
main is not correct
Scribe any issue ok console
Yeah what he told
no worries
Also don't name your plugin Main class as Main it's not a good practice i'm Java development
basically plugins are loaded with the main class and since it cant find that main class its saying fuck u
Yeah i know i was just testing
there is no valid reason for it to not be a good practicd
but taah I have to say
Thereās also no technical reason for us to use lower camel case in field naming
yeah of course again, there is no "reasons" its just "encouraged" i guess
we just do it because of its usage in the SDK and conventions written years ago
for why irs encouraged? no idea
"java naming conventions"
but "naming conventions" dont say anything abt Main
Encouraged because SDK developers did it decades ago xd
as far as i know only people here have said ir
if sdk developers tell me not to use Main then sure
yeah am not sure who started the main thing
Nope, hs
Tbh we met a long time ago, I was lying about my age most likely lmao
Yeah, thatās the most likely route
haha its okay a lot of ppl did
Please just don't dicuss about Java cvoncentions and just foklow them
It might be a branch like embedded engineering, but I might just go straight cs
there is no java convention about Main
that is what we are saying lol
gotcha! good luck in that man
CS is definitely interesting
Ik but this for programming help if You dicuss is diff to get heped
How are you doing, on that topic?
i just started my first year in september and finished my first quarter
did my first data structures and algorithms class
Ahh how is it
Please for that type of things move to #general
@zinc egret how are You going?
Doing what morice?
Someone was getting helped
Read full chat
And im surely he stopped asking because they startrd to dicuss
no he got helped
.
So comming back Pierre
look at my repo
14.01 00:02:07 [Server] [INFO] [PLHideHelp] Loading PLHideHelp v0.0.1
it loaded on my server
For creating You have to do some things
-
Implements the CommandExecutor interface
-
Finally register your command via plugin Main class and via plugin.ynl too
Havent You update your code?
Okay what You have done its pretty okay
Now i would suggest following the next tuto for creating commands https://www.spigotmc.org/wiki/create-a-simple-command/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Updated github???
For that i recommend using a library for that
For example gson, which already came inside the spigot
yea but like
is it possible to store it globally?
instead of loading the json file everytime
well globally or some other way
What is "globally"
I don't understand your contexto global
do u mean a static reference?
if so, i think so since u can rely on gson / or a json library
an alternative would just be storing the memory object in the plug-in class, then sharing that with DI
yeah
data = json.loads(read("xx.json"))
def command():
global data
print(data)
command()
def command(ctx):
data = ctx['data']
command({'data': {}})
something like this i guess
this sounds like what i need
yeah thatās this
At least the closest java can replicate
how tho š„ŗ
well the real example is with static reference
but we arenāt going to teach bad habits
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Anyone have a good gson/Jackson tutorial on hand?
how would i go about doing this?
Like the guide says
json itself should be pretty simple no? or is gson diff
JSON is the standard, gson is the library to parse it
and obviously once you get into gson you need to actually know how to load it and use the memory object, thatās the purpose of a gson tutorial- how to use the library
(Gson is just a library by Google to parse and serialize json)
wait...
the goal of my plugin is only 1 command
cant i just pass the json when i this.getCommand("plhhelp").setExecutor(new HelpCommand());?
Then why do you need json
what json are you using
.config
He habe done My fault, he startrd coding first without learning all the Java theory basic things
.configuration
?config
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
well actually my goal is this:
like imagine a json file with
{ group_name: [commands..] } (lets call this groupes)
and another json file with
{ command: 'Use this command to ....'} (and this commands)
and whenever someone would call /help it would send "\n".join(commands[command] for command in groupes[group_name]) in chat
in Minecraft dev we use yaml
Java doesnāt do those oneliners
i also have to read the perms of the player because i need to know what plhide.group.xxx theyre in
unless itās for user data, then json but we recommend an actual data engine
it was just an simple example
what i need then would be
Yeah for plugins configuratiom we use yaml files and for storing data either databases or Flatfile (H2, Json, Sqlite, etc)
No, depending on the case, json is just better sometimes
Configs yaml yes, but not data at all
mate read my further messages
did I like not specify that
to the point you had to comment
Json is for storing data, that is the intention why they create it
You specficied "user data" not data at all
wait can i read the yaml of another plugin?
my bad, too general
or i just copy the file tbh
Yikes
You could but why...
Well, there is a lot of data not relative on players
I.e region data in world guard is user generated
because users create regions
and set flags
You can load another plugin files from your own plugin
there's this plugin that hides command auto completion except for the ones they have acces to, but i want to make it so that when someone types /help it only describes the plugins they have acces to
Its simple Json is just for data storing
anyways, any data that should be file modified by the user should be in yml
Yes
That seems like a kinda meh idea. And not very scalable at all if you want to access other plugin configs.
Json data storing or data representation
Yaml more for creating configuratioms
Yes
and I agree, my message just wasnāt specific enough
yāall staying on a topic that is not necessary
Youhopened that topic š¤¦āāļø
Oh sorry
Just shush smh
Well i'm this case i Will use yaml for configurations
And Json just for storing data
anyway im in desperate need of help š (like litteraly i want help)
Pierre what Will your plugin make
.
i can just copy it tbh
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
for groups, loop the group names in the config (loop getConfigurationSection(āmessagesā).getKeys(false))
(Assuming your config is:
messages:
default:
- āHelpā
```)
groups:
#if no group is set via plhide.group.<group> this will be applied
#do not rename the default group!
#blocked commands will be automatically removed from the tabcompletion
default:
commands:
- help
- home
- spawn
- delhome
- claim
- unclaim
- claimlist
- trapped
- nick
- nickname
#If the value is blacklist, the commands are blocked and invisible
#If the value is whitelist, the commands only executable and visible
group-mode: whitelist
#If a player is in two groups, the group with the higher priority number is used
#The minimum value is 0
priority: 0
#here you can add other groups
#The group mode is taken from the main group, in this case the main group is "default"
included-groups: []
#This group for example will remove and block all commands
#add permission plhide.group.xxx to apply this group
Donator:
commands:
- prefix
group-mode: whitelist
priority: 1
included-groups:
- default
Donator+:
commands:
- fly
group-mode: whitelist
priority: 2
included-groups:
- default
- Donator
Admin:
commands:
- plhide
- lp
- op
group-mode: whitelist
priority: 20
included-groups:
- default
- Donator
- Donator+
this is the yaml from the other plugin
for checking groups, use player.hasPermission(āgroup.ā + groupName) assuming player is a CommandSender or Player object and groupName is from the loop value I sent in the example above
but honestly i only use whitelist so i can negate the group-mode and priority
wel im not going to teach you how to code such an extensive plugin, the example was just to show you how to get the keys under a config section in case you didnāt know how to do that (you probably donāt given you just started with snakeyml)
What is the best way to check if two strings match? I know this is a stupid question but it seems like every time I send my code here and I have anything related to string matching somebody says the method is wrong.
Also can I use spigot to create a book that has clickable text that will add more text into the book(it will be a written book) and so that I don't have to add a ton of different commands and sub commands to change whats inside the book based on the players clicks and such
cant i do something like
commands:
spawn: TP to spawn
home: TP to home
prefix: set new prefix
groups:
default:
commands:
- spawn
- home
donator:
commands:
- prefix
```?
so that i can just loop over?: for command in groups.xxx.commands { commands[command] }
it looks like it but isnāt lol
but this isnt python because i used curly brackets
imo python is stupid bcz it uses indentation instead of curly brackets
Do you want me to write you something to help you do that, and then you can attempt to figure out how it works?
will not spoon feed in the future unless itās a new topic, so I highly recommend actually trying to figure out what each thing does
thatās honestly the best way to learn in your case when you have experience in previous languages and just not the syntactical structure and SDK of Java
as much help as you can / want
i like being spoon fed because i learn fast from just reading working code
rust, python, c++ so yeah... š
oh you said figuring it out myself best way
but anyway i figured i need to put Plugin plugin = getPlugin(); somewhere? then plugin.getConfig()
No I meant figuring out how I coded it
Because you can imagine the structures you need to accomplish something, just not how to implement
By reading Java code that implements those structures, youāll make relationships with your previous languages
oh yeah i think i can figure it out with the functions you send me
just struggling with getting that plugin
you meant these right?:
(loop getConfigurationSection(āmessagesā).getKeys(false))
player.hasPermission(āgroup.ā + groupName)
youāll see
what do you mean youll see?
from my code ;c
@worldly ingot I just forked bukkit and craftbukkit.
Bukkit is fine when I clone it in my ide but craftbukkit has some pom.xml errors
One of the craftbukkit errors was fixed simply by compiling bukkit
Here are the errors in my pom
public class HelpCommand implements CommandExecutor {
private YamlConfiguration config;
public HelpCommand(YamlConfiguration config) {
this.config = config;
}
// Last 4 lines known as a Dependency Injection pattern.
public boolean onCommand(CommandSender sender, Command cmd, String lbl, String[] args) {
String userGroup = null;
for (String group : getGroups().clone().reverse()) { // Remove .clone().reverse() if top value of list is the highest group in a hierarchy.
// .clone() will duplicate the list indexes (not the elements, unimportant to know difference for now) into another list
// .reverse() will reverse the order of the list, so 0 -> last index, 1 -> last index - 1
if (sender.hasPermission("group." + group))
userGroup = group;
}
if (userGroup == null)
userGroup = "default"; /* Assuming you have a group named "default" and it's the "member" group */
sender.sendMessage("Help:");
for (String command : getCommands(userGroup)) {
String description = getCommandDescription(command);
sender.sendMessage("/" + command + ": " + description);
}
return true;
}
private List<String> getGroups() {
return config.getConfigurationSection("groups").getKeys(false /* true for the keys of every element below and even further below. */);
}
private List<String> getCommands(String group) {
if (group == null)
return getCommandsAvailable();
return config.getStringList("groups." + group);
// As an alternative, you can always use config.getConfigurationSection("groups").getStringList(group);. Both work.
}
private List<String> getCommandsAvailable() {
return config.getStringList("commands");
}
private String getCommandDescription(String command) {
return config.getString("commands." + command);
}
}
public class PLHideHelpPlugin extends JavaPlugin {
...
public void onEnable() {
...
YamlConfiguration config = getConfig(); // getConfig() provided by the parent class JavaPlugin
getCommand("help").setExecutor(new HelpCommand(config));
}
}
(abbreviation, will not copy your current code. add lines as necessary)
both are untested, written in Notepad++ so import as necessary.
Do note that this is immense spoonfeeding, so ask any questions that you have while you DO attempt to understand it
strongly encourage you to relate structures from any similar language to Java when you read through it
oh damn this is massive spoon feeding haha
it just bugs me that
things like getConfig and this are "just" there
instead of this.getConfig() and onEnable(this)
but you need to understand that this is implied & added by the Java compiler before it goes to the JVM
as for getConfig(), get used to it because this class is loaded & constructed by Spigot's plugin loader
it's just "there" because the class extends JavaPlugin
(to be more explicit you can write super.getConfig())
yeah, inheritance, if thats the right word
yep
i do like that more
I guess it's also a form of abstraction, but unimportant as all interfaces are abstraction
because at first sight you wouldnt know if getConfig() is an imported function or an inherited one
(abstraction as in the four pillars of OOP, not the Java terminology)
if it was imported you cant call it like that
any time you see just a method name, you know it's either in that class or from a parent class
okay well sorry that's a lie
how would it be then?
you can do something called import static in Java, but the number of times I've seen that can be counted on one hand
you import classes in java, everything is a class
ayo how many fingers you got?
so you'd have
import xx.x.x.MyClass
and MyClass.someMethod()
just the 5 š
so never
import xx.x.x.MyClass.someMethod
someMethod()?
unless it has the static modifier after import, correct
thats incredibly stupid if im honest
How can i create a world with the default ChunkGenerator with NMS? Any ideas would help, pls
it's just how Java was designed. to call a method liek that it HAS to be static, and if it wasn't static you'd need an instance of the class
(MyClass.someMethod() or instanceOfMyClass.someMethod())
you mean you wanna do the same thing spigot does when you create a world?
This is why you should never do something in Java with Spigot (or any library) without actually learning java
hmmm so someMethod() is possible if it doesnt use this?
for example, no you can not import sendMessage from org.bukkit.Player
because sendMessage requires a Player instance
yes but thats obvious
let me explain
what is a static modifier?
i know how instances works etc
but what if a function doesnt need an instance?
I want to make a world with less oceans, so i thought i could get the default ChunkGenerator and then replace oceans with other biome or surface.
has anyone here forked craftbukkit?
you have 2 types of invocations: a static invocation and a direct one (this is not a JVM topic, just a simplification).
A direct one is typically someVariable.hello(). HOWEVER, the exception is when you declare the method OR a class you implement/extend declares the method. Then, you have this as a keyword because you use the instance the code is currently running in of that class. Like, inside of the org.bukkit.Player class, you have sendMessage(String s). Assuming a method inside of that class wants to call #sendMessage(), it doesn't have a variable (called field, parameter, or variable for local declarations) as the instance of the Player. It does, however, have an instance because it's currently executing, and that's what is provided by the this keyword. The inclusion of this is implicit, unless you're attempting to pass this as a parameter. For example if I have Util.sendMessage(Player player, String s) defined as a static method (will attempt to explain shortly), then to call it inside of org.bukkit.Player I'd need to use Util.sendMessage(this, "Hello World")
A static method is a method that doesn't require the instance of the declaring class to execute. That also means you can't access non-static fields from it (variables declared at the class level). The inclusion of this keyword is NOT present to call a static method, because you aren't invoking it with your instance. You may pass this into a static method, but the method will not be invoked from this. this.staticMethod() is not possible, staticMethod(this) is. Do note that the this keyword is also NOT accessible from side static methods because there is no instance for this to represent.
As for the question about static modifiers, I don't know that static is a modifier in the import statement per se, it's a token for when the Java compiler compiles the file. However, "modifier" is a term used in Java, and that's for miscellaneous tokens such as "static", "private", "public", etc. These are the first two brackets of info (in my example below) in the method declaration:
[access modifier] [etc modifiers] [method name]([method parameters , ...]_ { ... }
(long read but all of it is important info)
imo class methods should use an argument for this and when its called on an instance it automatically passed that arg, this is how its done in most languages afaik
not really able to take all that text in, its kinda late for me
you better read it when u wake up, otherwise I'm sending you an invoice for the time it took to write all of that
haha i will
btw you used List, import java.util.List; this one?
Yes
Isnt what i have been sayimg from the start?
I don't told it as mad, just for personal experiences
i never said a word of disagreement about your statement
yeah it's because with previous knowledge in programming, you're going to dive straight in
Oh ok sorry Itzdlg idk why i thought You we're attatching me. My bad
nah you're good
I habe relized that Async it's not definitly so simple
š
It's more what You think, idk why ppl said it's easy to understand. I don't really agree cuz the concept is clarify. But not the implementation because you have to take care about sync around the data, concurrencys, threads and pools
gotta dive in those 3" inch right from the start š.
no use in taking it slow
well I agree with VERANO on the learning java
but I've been hypocritical in the past on that exact statement
like when I was learning Rust, I was attempting to use winsafe crate basically immediately
(still don't know Rust, so perhaps that's a testament)
write an essay rn on how the borrowing system works
š«
Itz let do our things because ppl like that won't listen us. Si the Best thing is to ignore them
well I might be able to do that only because a cool video existed in a series called Rust for Java developers
there's no way I would've read the Rust book documentation though
i struggled so much with the borrowing system, but then it just clicked
but tbf i was coming from python
shit is so boring
doesn't make it any easier coming from Java, it handles that for you
true
Hey please personal problems must be solved vis dns. This discord is for supporting ppl which has knowledge atleast how Java works
honestly im not really struggling with the syntax
but i am really with the structure of gradle
or atleast i was, now i somewhat get it
but you have to configure alot and name stuff very specifically
like for example Rust has Cargo
which is amazing imo
but as far as i have noticed you have to supply your own depency source, instead of a centralized one (like cargo from rust or pip from python)
I personal think You doing things really wrongs, You must first learn the lang we're You coding, then dependency build environments and finally work with 3rd party libraries or apis
that wouldve just been so much longer
So if You expected yo get help You must know the lang we're You coding. So it's not really simple i ask something get all served on plate without knowing what even does
i mean if we were talking about java -> rust, yes learn the language
but rust -> java, aint no way
So definitly programming is not for You
why are you so mad at me
this too
If I was creating a quest system that used NPC's to basically only give a book that contains the quest information and whether to accept or not would I need or even want to store the NPC's inside a database?
You making mad because You Dont listen US, WHO we have experiences about Java programming. That males You look like little teen. Not wondering to be rude
Why would you stores the NPC?
Will You then need to use it?
we just have different learning approaches?
Lmao what an amazin way of learning ššš¤£š¤£
Fr
Like i have said before if i would ignore this from the start all this wouldnt happen
why in gods name would i want to start watching a youtube tutorial that covers shit like a + b and storing variables, if i can just look at working code and see that [type] [name] = [casting] func(); or [type] [name] = new [type]();
of course there are complex stuf out there but i will learn those along the way
You can't just start programming stuff without taking the time to learn and then waste others time due to your lack of experience and unwillingness to learn it properly. If you just take the time to actually understand what you are doing it will save you and others so much time in the future @zinc egret
i understand what i am doing now, big thanks to wholesome white bear guy
Also what would the best way to store a book inside a database be? can it be done reasonably with a single MySQL column or would it need/want multiple?
i learn quick from examples
BRUH do what ever your ass sang but don't expect to be helped on that way
š”š”
You know make me raged
bro chill
throw it into a column and be done with it
unless you need to SQL query based on book data but you'll be writing an SQL structure for that for ages
itzdlg was willing to spoon feed me (although it was more than needed)
I would be querying based on another column
then you'll be fine
Would that be like grab the ItemMeta or ?
uh
there's ItemStack serialization gists out there
find one that works with books
anyone have something on hand that works with complex ItemMeta like books? pls share for this wonderful guy here
you're dramatizing, just relax kiddo
private List<String> getPlayerGroups(Player player) {
Set<String> groups = config.getConfigurationSection("groups").getKeys(false /* true for the keys of every element below and even further below. */);
List<String> joined = new ArrayList<String>();
groups.forEach((group) -> {
if (player.hasPermission("plhide.group." + group)) {
joined.add(group);
joined.addAll(getInheritedGroups(group));
}
});
return joined;
}
how does this look to you @compact haven
its likely that joined has double groups in it tho
wait i can just use set, if its like in python that is
oh yeah lol
I have read abou Async on Java and it's not so simple as most You have said. Because in Async you must care about concunrencies, data sync around the threads, and many other things
private Set<String> getPlayerGroups(Player player) {
Set<String> groups = config.getConfigurationSection("groups").getKeys(false /* true for the keys of every element below and even further below. */);
Set<String> joined = new HashSet<String>();
groups.forEach((group) -> {
if (player.hasPermission("plhide.group." + group)) {
joined.add(group);
joined.addAll(getInheritedGroups(group));
}
});
return joined;
}
anyone here has forked craftbukkit?
well this doesnt make sense
if you give them a permission plhide.group.xxx then just check for the groups inside of your config.yml
not their actual groups
otherwise don't give them a special permission at all
you need to work on your logic here
?
plhide.group.xxx is given by a different plugin
it determines what group they are in
wdym given by
which groups someone is in isnt stored inside the config
title: <book title>
author: <author name>
pages:
- <page text>
- < .. more pages .. >
generation: <generation code>```Would this from https://www.spigotmc.org/wiki/itemstack-serialization/ work?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
why do you need all of their plyer groups
and not just the one that matched
I'd only need the ones that matched because that's all that you'll use
someone can have multiple groups
sure, but you just said that those groups aren't inside of the config
you need to make sure the groups they inherit are also inside the config
i think we are miscommunicating
is getPlayerGroups for the help command?
they are
given that you copied it.. i'd say yeah
Well yeah
let me come back in 15 minutes and i'll push it all to my github
there is a centralized one as well. those will just require the dependency. but the stuff from spigot is not on there.
oops looks like i wanst looking at most recent messages, sorry
why not tho? im interested
it'd have to be accepted by maven central i guess. for which im not sure the requirements are.
||```
Set<String> joined = groups.stream()
.filter(g -> player.hasPermission("plhide.group." + g)
.flatMap(g -> Stream.concat(Stream.of(g), getInheritedGroups(player).stream()))
.filter(g -> groups.contains(g))
.collect(Collectors.asSet());
if you want it to be streams, only providing this because you used the .forEach (which I'm going to assume was copied from somewhere else). however, I will admit this is convoluted and just wanted to expose you to streams (this specific example is probably slower than what you're doing now). ulterior motive haha||
read if you want spoiler to a cool Java feature that probably has an equivalent in one of your languages
i actually did use streams later on
crazy nice
its like .iter() in rust
ah I see, that's where you got forEach from I'm going to guess
i found forEach first, streams later when i tried .map
ahh
intellij autocompleted it to stream().map
ahhh, nice pfp btw š¤
yep yep you've experienced the benefit of having previous experience
thanks, haha
new people would be completely clueless to how streams work, u can relate it to iter
yes
whereas you would've been exposed to that way later on if you followed "how to Java" conventionally
although in python its done differently
which wouldve sucked (i've tried java from start)
@tall dragon what is that from? just curious
ah I see
in python you actually have to "implement" __iter__ a function on each class
^^
I mean, anyone who has made a spigot fork has
i need help
not in reality, but effectively
i forked it but it has a bunch of errors
(they jsut cloned and made patches, then applied them)
well that really sucks lmao
building bukkit (not craftbukkit) fixed some
I'd attempt asking in PaperMC because they're probably experienced in cloning CraftBukkit
i have these in my pom
well I ahven't personally done it, so I can't help xd
forking paper is actually easier
forking paper sounds really stupid in my head
lmao
like why tf would you wanna put paper on a fork
well xd
@compact haven it worksss first goo letssfffff goooo
i changed it to just returning the command names instead of their description (i still have to write those)
W
what does this mean?
final is a modifier in java
it's similar to making something immutable in rust
i.e. not including the mut keyword
though do note that iirc in Rust if it's not mut then you can't modify the values inside of the struct
but in Java you can
(lmk if I'm wrong on that)
if something in rust is not mut, then everything inside is also not mut, well it can be mut but you cant acces it as mut
it would be &&mut or something
guys
gotcha, yeah in Java if it's final then that just means the reference of "config" is locked to that instance of YamlConfiguration, but the values inside are still mutable
maybe if you go inside the unsafe terrotory
i need help with some problem in the world generator
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
yeah you mean like you cant redefine config with a new instance?
correct
yucky behaviour but still fine
i dont know why the world is generated like this
||looks perfectly fine to me š ||
no
im just kidding
I mean if the goal was Minecraft vanilla generation then yes, way off!
xd
but if you're trying to be unique, then A+
it looks like spectator mode ngl
im in creative
well, minus the falling entities
no I know, I mean like if u generate a vanilla world and go into spectator below the surface
it looks like that xd
yes xd
let's see ur current code
rng?
will need to repeat 1 billion times to be reasonably positive it's a mistake
uhm, RNG = random number generator
kind of slang for saying the random number is never in your favor
(will assume that there's some sort of random inside of world generation code)
@fiery shadow show your code
btw @zinc egret an interesting alternative to consider would be instead of groups, just have a list of commands & their permission + description
then just display the ones, in order of declaration in config, that they have permission for
that last filter is kinda abundant, because i know for sure it has to exist
mm, idk the implementation of getInheritedGroups
if it is based on the ConfigurationSection, then absolutely
that actually sounds like more work
yes...
however it's more structurally sound to me
logical might be the better word
but both work, absolutely lol
current one is cleaner imo
btw
what if i want to make it so if the command description doesnt exist?
contains?
should spigot have a method to open an inv with a custom name?
wdym
oh i see
like I have test as an entry in one of the group sections, but no test in the description section?
yeah
you could add a filter(cmd -> getCommandDescription(cmd) != null)
private String getCommandDescription(String command) {
if (config.contains("commands." + command)) {
return config.getString("commands." + command);
}
return "No description found";
}
```i came up with this
or filter(cmd -> !config.getConfigurationSection("commands").contains(cmd))
because i prefer to know which one have been added yet
that works
is it good tho?
however if you want to be special, you can
why not just do ```java
return config.getString("commands." + command, "No description found")
overflows be like š„“
that filter was for the stream in the command exec part
idk I only just joined and see that they did if/else to return a default value
the special was going to be ternary, but that is the correct way @zinc egret
you can add an extra argument which is the "default" value
yeah
and it's only used when the node isnt found
its like python's dict.get function
the same also goes for a Java Map btw
iirc it's required by implementations to have a get(T key, V default) method
T & V are generics, another pre-exposure like I tried with streams earlier (unfortunately failed so attempting again)
idk about Rust but pretty sure C++ has an equivalent
iirc that was one of the languages you know
you mean overflows?
no overflow
same functions different ways to put args
overloaded
its overloading ye mb
but no I meant the letters T and V, they aren't classes but a placeholder of sorts
yeah generics
if HashMap<T, V> then HashMap.get(T key, V default)
Hello,
Can someone help me to find this plugin?
I need a limitation of claims per group.
For example:
Group 1 - can have only 1 claim
Group 2 - can have 2 claims
Group 3 - can have 3 claims
Group 4 - can have 4 claims
Gruop 5 - can have 5 claims
Group 6 - can have 6 claims
exactly
well prepare to be disappointed, because Java generics only exist at compile time
L
L java
get(Object key) :c
oh yeah
python actually doesnt have overloading btw, because there are no types during compile time
isn't Map generic, but uses Object in the declarations
yeee
wtf is up with that, is that because it was written pre-generics?
OHHH you were talkign about Map not map, i was confused earlier haha
yeah python has optional arguments
which are nice, but slightly weird
oh yeah I meant the class, not the stream method xd
hehe
they are just overloading but done differently xD
big fan of kwargs tho
idk what kwargs is, but we have varargs in Java
java also
method(Optional<Hehe> hereComeLol)
oh so varargs is equiv to *args in py
yea
whats kwargs?
passing a map basically
def function(name, last_name = None):
if not last_name:
last_name = ""
print(f"Hello {name}{' ' if last_name else ''}{last_name}")
function('p', 'v')
function('p')
def function(*, **kwargs):
print(kwargs)
function(cheese = "ham")
# ->
# {'cheese': 'ham'}
function()
# ->
# {}
def function(*, ooga_booga = False):
print(ooga_booga)
function() # False
function(True) # False
function(ooga_booga = True) # True
wait shit
I think that's for optional args
we don't even have that in Java
it's so lame
need Kotlin for that
instead we need to write like 20 overloaded methods that call the actual method with the defaults
ye
I just saw your previous message Conclure
and Optional is like not the equivalent š
you still need to pass Optional.empty() instead of excluding it
edited
same in rust
ye it was kind of a joke
but also method overloading with optionals is clowny stuff
oh yeah
because once again, generics erased at runtime
and fucking method overloading
@compact haven how can i reload the config without restarting the plugin?
oh i just realized
can you look at this conclure?
anyone who has written a PR for Spigot has done what you are
yeah
that's a sizeable amount of active peeps here
well unless they didnt test it lmao
nope im sry
or not in that way
woah rly?
yea figures
let me have a look
sure ty
uh Pierre, that's a great question
can you reload getConfig() (to the others)
or should you just getConfig().load(new File(dataFolder, "config.yml")
oh there's reloadConfig()
how convenient
@zinc egret you'll need an instance of your Plugin class, and then call reloadConfig()
so inside of a ReloadCommand, instead of passing YamlConfiguration config, pass Plugin plugin, and use plugin.reloadConfig() inside of the command exec
lmao that's me all the time
I decide I want to try something new too late to actually get very far
so what does the errors say?
though tbf you've gotten further than I would've expected
or like... what does ur ide say
wanna come back to this btw š
kay that might be an overuse of streams
in sense of the plugin?
yes
wouldnt have been without you
EXACTLY that
honestly i shouldnt have continued when i came back to my pc at ~23:30
so thing is like
nah its ok
thats a prop
W spigot programming
i looked at the pom
or actually
it isnt listed
W java (exception of old libraries that haven't been updated since like Java 6)
weirdly enough minion
no it is not
i love those one liners
because its linear
you dont need to jump lines to understand it
I mean, technically, you can put that entire java file into one line
and it'll still compile
though I understand what you mean xd
like
if you'd be adding to a variable thats defined earlier
you gotta look back at that variable whenever something gets added to it
linear is just easier to understand for my smooth brain
lol
btw I'd recommend not using Set for commands
because ideally you'll have some sort of organization
if you want to return it as a set from the config, then in the stream use a sort alphabetically (where you sendMessage)
bro as if you read my mind
i was going to do that from the start
was looking over my code for cleanup and finalization
realised i didnt do it yet
lmao
implemented it and came back to disc
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player player) {
player.sendMessage(
getPlayerCommands(player)
.stream()
.filter(Objects::nonNull)
.sorted()
.map(c -> "/" + c + ": " + getCommandDescription(c))
.collect(Collectors.joining("\n")
)
);
}
return true;
am just that good of a peer-reviewer
for real
please put a space before the return and move the closing bracket of the stream & sendMessage to the end of collect
before I come after you with an axe
no
you must format the way I would. sorry.
oh well. seems you need an intervention in the form of capital punishment
lol
bro
i just joined my server
typed /stop
then got confused when the server suddenly stopped
thats my brain rn
uhm dw you'll do stupider in the future
thanks
with a fully active brain I've recompiled several times to ask "why isn't this updating"
or i just stop developing java plugins
to realize I didn't actually put the new target into the server
OR I've put the recompiled plugin into the root directory instead of the plugins directory
š
(if you ever come across this in the future, the root directory is called the "worlds directory" in Bukkit and is accessible via Bukkit.getWorldContainer())
lmao, thing for tmrw i guess
sounds like a skill issue tbh š¤
probably a simple node naming error in the code
like command. vs commands.
go look
then dont compile
and make yourself think "was that the solution"
all night while u attempt to sleep
see I can be a sadist at times
reloading also doesnt work
bro how do you think i'll attempt to sleep
as soon as i hit my bed im gone
lmao
that FR is clearly the "im done and we'll talk later" cue
go sleep lol, dont forget abt Java
yes thanks for the help <3, will be back tmrw
let's see the line that it occurs
seems like you're calling setProcessComments on a snakeyaml configuration
which isnt a method according to the stacktrace
what mc version?
that may be the issue
the snakeyaml in 1.8.8 is OLD
waterfall is the proxy
?1.8.8
yeah 1.8.8 snakeyaml is very old
not sure
I'm not familiar with this lib
at us.newrealms.timebounditems.TimeBoundItems.onEnable(TimeBoundItems.java:28) ~[TimeBoundItems-0.062Snapshot.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[paper-1.19.jar:git-Paper-31]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-31]
at java.lang.Thread.run(Thread.java:833) ~[?:?]``` I'm not sure what would be wrong inside of my code to have caused this. if anyone can help I would appreciate it.
@humble tulip can you give me an example of 'Forward' channel? I read the docs many times. but can't understand it
I want to send a custom string. so look like I need to use Forward channel
@warm light show code
here is the code
I am confuse with channel things
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you can copy the code from here
got it?
how can I make sure its my data? now from other plugins
it tells you how to
change MyChannel
so I can set the channel name to anything?
yes
what does this called "Forward", "MessageRaw" etc?
Think of the plugin messaging channel as a way to send and receive data