#help-development
1 messages · Page 461 of 1
thats a feature right
so its hard to define that as a performance footrpint
yeah I saw
I was gonna ask the others if we do those commands for 3rd party libraries specifically
Is that English
Rip conclure
lol very
I mean even corrected I lack context so maybe that’s it
Idk what third party libraries and commands are being referenced
that was to morice
I assumed as context was missing
?pdc
^this1
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
Ah
?nms
not a lib though
<scope>compile</scope>
what
didnt know that
btw its the same lol
Im trying to make a plugin that listens for an packet sent by a modded client, the packet ID is dark_list:packet, I am trying to use protocollib but I cant seem to get it into my build environment
pomxml
Yes, it has been added to my build.gradle as shown in the repo, and I have reloaded gradle to get the deps
What?
at this point this plugin is meant to be simple
Does the server even receive modded packets
get packet from player
if packet contains data server dont like (blacklisting mods), kick player and tell why
custom Packet Channel,
thats the plan atleast
The custom payload packet?
ye
You don’t event need plib for that
teach me thine ways
this is my first plugin
the mod side was also made by me
I can send the link to the mod if you want to see how it works? it has server and client logic in it
Will this work with Paper/purpur servers as well?
It should
I’m fairly sure that can listen to external channels, if not then yeah protocollib is the best bet
After updating my plugin from 1.12.2 to 1.19.4 I am getting this error: class file has wrong version 61.0, should be 55.0. How can I change a file version to 55.0?
The pmc should work fine
are there any official "hello world" plugin examples?
61 is java 17
55 is java 11
You can take a look at Chocos veinminer plugin and mod
It uses the pmc
I cant look at heavy code for starting out
Still mostly new to java and the extra information overwhelms me as I cant figure out what I need to keep the code running
Not sure much else actually communicates with client mods
It’s a fairly niche functionality
It has much more than I expect
My project version is 11 it seems. Do I need to do something with the pom.xml?
I’ve done it but only from server to client
pom.xml controls your source and target java version
I tried changing it from 1.8 to 1.11, no luck. I'm just a little confused sorry 😅
I believe it’s just 11
This is correct! Thank you. However I'm still getting compile errors.
[ERROR] /D:/Server Stuffs/_LOCAL SERVERS/.7 Realms/Plugin Source/src/main/java/me/combatborn/realms/mechanics/realmitem/RealmItemManager.java:[6,33] cannot access org.bukkit.inventory.meta.ItemMeta
bad class file: C:\Users\Hunti & Hopi\.m2\repository\io\papermc\paper\paper-api\1.19.4-R0.1-SNAPSHOT\paper-api-1.19.4-R0.1-SNAPSHOT.jar(/org/bukkit/inventory/meta/ItemMeta.class)
class file has wrong version 61.0, should be 55.0
Please remove or make sure it appears in the correct subdirectory of the classpath.```
They stopped using 1. In Java 9 and above
Okay I just reset my workspace from scratch and now how do I setup the main.java? the thing I was using before was an plugin template that had excessive integrations and an structure I had difficulty following
Try switching to 17
It worked!
Thank you, sir.
aight what am I doing wrong?
What’s the issue
I dont think its outputting an plugin jar properly
should be in build/libs
Your main class is wrong
??
Main class in your plugin yml is wrong
You typed it in wrong
oh, i typed plugin not spigot
- Your not extending from JavaPlugin either.
- Main is a bad name for your main plugins class.
?main
yeah
Eyy! thanks, now to look into handling custom packet channel
okay could someone point me in a direction?
of documentation
?pmc
?jd-s
Is fine, I know the exact structure of the packet my mod is sending anyways
basically, just sends an table hashmap of String:String
modid:version as reported by the modloader
server can then specify in config an list of modids to not allow
and kick player
so basically, just gotta get that custom packet incoming on player login, then kick them if they dont have an authorized mod
Maybe
Is there a way I can make a aSyncChatEvent from a command
Like, have a command toggle a aSyncChatEvent like if the player sent a message himself
What
Can I create a new AsyncChatEvent from a command, like
/message <This is a message>
Will trigger aSyncChatEvent
You can manually fire an event, yes
based off the documentation it sounds like this fires that event https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#chat(java.lang.String)
declaration: package: org.bukkit.entity, interface: Player
and it makes the player chat
if that's what you're looking for
oooooooo
Yes that will fire the event
But it will likely be sync
It will be ran sync.
🖤
If a player is the direct cause of this event by an incoming packet, this event will be asynchronous. If a plugin triggers this event by compelling a player to chat, this event will be synchronous.
You can check if it’s sync with Event.isAsync
isAsynchronous? One of those
Thanks guys
learn spigot plugin development 😉
You need to bribe him
Bribe with free java lessons
Idk I think MD knows java
This is how I learn
By doing the project
minecraft doing funky logic
Make sure the jdk is in the PATH as well.
its literally the jdk
like, it always worked like that
idk whats happening
What does java --version show in the terminal
Make sure the project in the IDE is set to the right jdk and language level etc..
Is there some reason why my new command is able to be run in game by /pluginname:<command>
Is it possible to change the default minecraft experience curve values?
Some classes/methods to do so / look into would be much appreciated
this looks good?
Because /pluginname:<command> is the full command name. All commands will work like that. You'll still be able to use it just like /<command> though if it's registered correctly.
Is there a way for me to hide that plugin side or will I have to handle that using a separate permissions plugin
You don't need to include the src/main/resources
I have zero clue what I am droing wrong. I am referencing Vivecrafts plugin for how the code is implemented and its the same format, differnt logic internally but the frame is the same
only redeem.yml?
Why is it giving the red squigly!?
It’s the same permission as the regular version
Bukkit.getLogger
this is how I am lol
I just made every plugin dev here cringe HARD didnt I?
Bummer
You can disable all of those with a server setting iirc
But not individually
And for good reason, plugins may register commands with the same name
At least, for me, no, i used to do that lol
Just discovered Bukkit.getLogger and my life got better
There is no getLogger
Don’t use Bukkit.getLogger either
then what do I use
Your plugin has a logger, use that
Yes then that
I was making my own from scratch!?
Mhm
confused
-_-
No?
Lmao
Ive seen too many people using that one
Gonna have an aneurism
Just use plugin.getLogger();
then what coll
Wat
this.getLogger if ur in main
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
[21:53:40 ERROR]: Could not load 'plugins\TenguCore-1.0.jar' in folder 'plugins': uses the space-character (0x20) in its name
wwaaht
You cannot do that
Yee
maybe a confussion creating the plugin
lol
yeee
i love spigot
especially their errors
yee
and how do i get this, into other classes?!
Wait are you able to create an alias for the long plugin name so instead of having to type /pluginname:<command> it'll show up as /command
oh..
Just make it static
like, how do I get PacketHandler, to be able to use the logger
or inject to the class
The non-namespaced one is the alias?
Buddy, still new to java, and those guides that everyone get sent to do nothing for me, and my attempts to make it static, IntelliJ says no
yee
oh that happened to me in the start
?di read up on this
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
its easy to solve
i can show you an example if you need
I get to this point
Yes but I want to hide the original
you can make an instance static
so I was curious if i can turn the original into an alias
I want to slam my face through my desk,
You want to hide the original
idk, i tried to do that it didnt work
But not the namespaced version
look
lets say this is your class
yes hide /pluginname:command and not /command
Oh
because the first one looks and feels ugly to type
So you want to hide the namespaced one
top left Code > Generate
So? You don’t have to use it
Then don't type it?
Pop into VC real quick?
this intellij
It shows up on the list of commands is what i mean
is just a new UI
Constructior
I know i don't have to type it but I'd prefer to hide it so if you look at the list of commands itll just show the /command
I guess if it’s a private plugin that’s fine
You can probably remove it with the PlayerCommandSendEvent
@ember comet Just leave static logger null. Then from onEnable() method set it to your plugin's logger instance
i have this code, how should i values to it? I know with the config.yml file is just write in the IDE and saveDefaultConfig, but here idk what to do.
Hmm I'll try it out thank you
@ember comet
public class PluginExample extends JavaPlugin {
public static Logger logger;
@Override
public void onEnable() {
logger = this.getLogger();
Test test = new Test();
test.sayHi() // [PluginExample] hi
}
// Another class
public static class Test() {
public void sayHi() {
PluginExample.logger.info("hi");
}
}
}
you shouldnt really be extending plugin base
public static like global variable
you should extending javaplugin
WELL YOU GOT A BETTER IDEA?!
I have been presented so many different ways
people keep saying one way is better than another
Sorry I've coding on nukkit
I am new to java, yall are way more experienced than I. traditional guides do not work for me because of my ADD/Autism, And the worst part? i actually have to state that usually because no one believes me
I barely know what I am doing, github copilot is helping but Im still doing the code work
the best bet you have it just seeing what you get given and seeing what works, slowly the traditional guides start to make sense more and more untill you can just scan through them and figure it out
You can watch KodySimpson to start
Its a good way to start and have some bases.
the main issue is java is an new language to me for the most part
I dont have the reference of the "frame" the language has,
oh i had no idea how to even code java before i jumped in the deep end
BroCode is a good youtuber to understand java.
Also, there is chatgpt, he will explain the basics
Such as constructor and stuff
chatgpt is so good for the stuff i cannot be arsed to google
flashbacks
Reading the Spigot Forums is also good, not only for errors
By a hobby
i like reading the forums
yes i know
now can someone help me? 🙂
chatgpt isnt too smart ig
either create methods there that save the stuff to yaml config like anywhere else or just have a getter for the yaml config
damn
it doesnt work like i thought?
Honestly, yall so far are way better than the GoLang discord, I was effectively getting looked down upon for asking questions and kept getting directed with teh XY Problem or to the Go Tour which didnt teach me shit, because it was giving me already completed puzzles or small peices with no understanding of how the peices fit
gpt said me this, i guess its good:
YamlConfig is what JavaPlugin#getConfig returns
Now we see if the server gets the packet the client sends
get path by "plugin.getDataFolder()"
so you can either handle adding data in the class you want to save stuff or you make general methods for it
What does YamlConfigurationOptions do?
Quilt/Fabric have an thing where it can check if the client "understands" the packet
does Spigot have such a thing?
Like i dont find anything util in it
damnit
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/file/YamlConfigurationOptions.html
declaration: package: org.bukkit.configuration.file, class: YamlConfigurationOptions
wait
im already there buddy
You don’t really need to worry about YamlConfigurationOptions
Let me rebuilt to make sure
It says right there at the top
Looks like it’s mostly for changing the formatting
ig this is all i need
Use set
Server does not appear to be getting the packet the client is sending on login
addDefault wont actually add it to the config
ehh
addDefault is for default values which the user can’t change
untill like next restart
save every time you do something
bleh
are you really trying to make a yml-based database
Heh
not a real db
just a list and a boolean
lol
i just put DB because i wanna look specific
idk
lemme be happy
no
can someone help me with the packet thing? the packet is coming on client login
what was the event again coll
the file name doesn't matter
oh
CreeperFuseChange iirc
I know stfu
no find
okay here
Nice job
yee
im going to play shapez game
You'll want to have a serializer
that loads and saves to that data class
I haven't done anything basic lately so I don't have any examples fuck
yeah there
You can make a constructor that takes in a ConfigurationSection
and just reads off of it
Then a manager that goes over all the sections and creates new objects through that constructor
like we do here
You can then make a save(ConfigurationSection section) method that saves back the data to the section
and call such save method from the same manager onDisable or on a repeating task
bout time you learn wtf is going on
I am learning but this shit no work
Maybe im trying to listen for the packet at the wrong time? Shouldnt there be a way for spigot to listen for an packet sent during login/connection?
you can but it's a bitch
I'd recommend you just use ProtocolLib for this
So there are 2 types of plugin message packets
one is sent on handshake
tried that, litterally could not get it to load in gradle
the other is sent on play
this is on handshake
This is on play
The idea here is that you can do a
<Mod> Hey, you up?
<Plugin> Yeah, I'm here
<Mod> vomits data
And if the response goes like
<Mod> Hey you up?
<Plugin> doesn't respond
<Mod> Okay then, I guess we're not communicating
nah, the mod just
<Mod> opens the door
<Server> looks at Player handing over data
<Mod> Vomits on servers shoes
sure
if you want to see the code
it can be as simple as
<Mod> AYO I OPENED THIS
<Server> Understood.
<Mod> barfs
Now keep in mind some clients might not have the mod
and some servers might not have the plugin
So you gotta handle both sides
And also handle invalid data and outdated mod versions
we should totally have a way for a mod to just kick a door down and vomit data at the server
Now, for bukkit
There was something like an IncomingPluginMessageListener from what I remember
The mod, as its written serverside
Makes sure client knows the packet code (understood is teh variable used in code)
then does shit,
Clientside, on login send modlist
haven't worked with it in like 4 years
If i could share my screen to you so you could see the code I would
it's 4:30am the last thing I want to do right now is see mod code
or the plugin code
What i just found is gold i think.
Material.GOLD_INGOT?
At least for me, i found a way to not hard write all the other files of configuration
Like it is with saveDefaultConfig();
But with any file
For me thats fucking gold.
saveResource?
Nope
Tmrrw ill try
It is in kotlin
But i can traduce it
Bukkit lib?
Damn
Yeah it’s part of JavaPlugin
Gotta try it
Nvm it was actually that
fun loadConfig(){
if (!file.exists()) HCFPlugin.instance.saveResource(file.name, false)
this.reload()
}
Well, from there i can start a little handler
For this config stuff

Hello, how do you guys test plugin that requires like more than 1 player? I only have one mc account
That is an acceptable time for offline mode
Why do you need 2 launchers
To secure the mc against choco the children slayer
Alts
Offline mode
Friends
You can boot 2 mcs from one launcher
Get good
So do I get t launcher
Also just dont use the official launcher
Anything that allows cracked mc launching
don't ever use tlauncher
Why?
it's outright not a good launcher
You can definitely launch multiple instances from 1 launcher
But it gets the job done right
At least with the non-windows store one
except there's much better launchers
Lunar is not cracked though
U need another mc account for lunar
And it’s like 20 bucks for another account
The pain of development…😫
Didnt minidigger make a launcher.
Could use his
Pretty sure its on his github somewhere
ive seen people make plugins that send msg in discord servers. Weebhooks or what ever. Anyone know how to make them?
You need a discord bot, a spigot plugin and a way of letting those two communicate.
Which part troubles you?
Good place to start would be looking at jda
letting them communicate
im able to code both individually but i have no clue how to let them do shi together
There are several ways of achieving that.
If i where to write something like this right now then i would use Redis.
Create a topic and let the spigot server publish and the discord bot subscribe.
aight thx ill read into that a bit

Hi, im making every monday start an event to spawn a wanderer, only the code don't run in monday or ever https://sourceb.in/cCzw3bOfhO
You can also just embed the bot in the plugin
Well if the server restarts then your scheduler will as well
If you want
and yes i know that so i made a system for calculating the day and pick the correct date
Your calculation doesnt do anything. You can remove all of this and the
code does exactly the same thing
not sure if my poor little raspberry pi will run that x)
so how can i manage to do run it every monday if that part is not useful
Scheduling like this is pretty hard. I would suggest an external library like Quartz to do that.
yh same
ok thanks i found the git repository
Hm, maybe Quartz is overkill. A simple polling strategy would also do.
I mean, couldn’t you just calculate the time until the desired event and then start a schedular for that
Each time the server starts
and what i did, when the server start it says in 0 days or more, but when running it nothing happens in monday
isnt there a way to simply request the current time each time the plugin start and then start a countdown?
yes but than gives the delay
@Override
public void onEnable() {
// Create a Timer instance
Timer timer = new Timer();
// Create a Calendar instance and set the desired start time
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, 12); // 12:00 PM
startTime.set(Calendar.MINUTE, 0);
startTime.set(Calendar.SECOND, 0);
startTime.set(Calendar.MILLISECOND, 0);
// Schedule the task to run at the specified time
timer.schedule(new MyTask(), startTime.getTime());
}
@Override
public void run() {
event here
}
}
this should work i suppose
and its the same as before
oh
what are you trying to do
running a task every monday
.
yes im using maven and imported 1 library
and what doesnt work
thatswhat im saying it should work x)
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
i mean making a scheduler which runs every 7 days will at some point probably skip a day
in monday at midnight the code don't start or run
and you would have to start it at monday which sucks
yes
have a timer which checks every now and then and see if its monday and midnight
once an hour or so
a timer with what Bukkit Scheduler?
Just run one every minute. If it's the correct day do the task then set a config flag to true or w/e. Then when it's not Monday set flag to false to allow it to run again
possible
ok, thanks
if (currentDayOfWeek == Calendar.MONDAY) {
timer.schedule(new MyTask(), startTime.getTime());
} else {
// Otherwise, calculate the delay until the next Monday and schedule the task
int daysUntilMonday = (Calendar.SATURDAY - currentDayOfWeek + 2) % 7;
startTime.add(Calendar.DATE, daysUntilMonday);
timer.schedule(new MyTask(), startTime.getTime());
Don't do that
why would you do that
i dont know just found that on github
Use a config with a simple bool and just check every minute. It will barely tax the CPU
Thats also how mc does it for halloween for example
just have a timestamp for the next monday midnight
Idk I feel like a very simple once-a-minute task would work:
if(isMonday)
// Do task
// set run=true in config
else
//set run=false in config
If you're worried about it running to0 much you can just do what smile recommended and just poll it
https://sourceb.in/GKwgHijTnq just done in this way
Is there an api for using loot tables
Idk why I asked that it was a 10 second google
I’m making a whole custom blocks system and the blocks gotta drop when you break them 😅😅
You can access the vanilla structure loot tables
I don’t know about block and entities
There is no api to make your own tables
yes you can
Nice
if you mean what i think you mean
Yeah it seems you can get and set the loot table of entities and containers
Blocks have getDrops
So you’re good there
i would probally do it with a mod instead of a plugin then tho
yes and yes
swords would probally be very laggy and ugly tho
you could make invis armorstand that holds it turned sideways
Or a ItemDisplay in 1.19.4
Tridents are easier since they are already an entity
well if you wanna do swords that would probally be a bit complicated to code but definetly possinble
tridands even easier if you use the baisic follow thingy from vanilla
idk if that easily accessible tho
of topic anyone wanna play a game of val
no
my personal opinion. learning books are useless. theres enough free content on the internet.
and if you want to learn in professionally
book an actual curse
corse
i dont know how to spell
its 9 am
well imo the books teach you less then videos
thats probally the first steps of object oriented programming
thats the java mascot
yo anyone know how to add license to plugins
you just choose one and include the license file in your gh repo
you do a web request to your webserver or some github file. all you have on spigot is the %%__USER__%% placeholder which will be their spigot user id
people who leak your plugin will replace it with a random number everytime though. people can also easily change /etc/hosts to "blacklist" your domain etc
well you also have the %%__NONCE__%% but that changes on every download
well what if i just check if the license is still valid every time the plugin starts
i have a license server from a friend i can use
and what will you do if that server is not reachable?
counts as license invalid
because e.g. someone set it to 127.0.0.1 in /etc/hosts
then you violate spigotmc's premium resource rules and your plugin is going to get removed
im not planing on putting it on spigot mc
then you are free to do that
however expect people to be very upset if their purchased plugin stops working just because your webserver is down
some dude whats me to code him something and he wants to pay later but i dont want to get scammed uk
ah ok. I usually use allatori to set an expiry date to the .jar file
i would remove it after
oh okay that could work too thanks <3
ofc they could just change the server's date/time, but in times of letsencrypt, where SSL licenses are only valid for 3 months, all shit's going to break in at least 3 months
aught thanksu
Hello I'm trying to reset my worlds asynchronously by creating BukkitRunnable async task:
But there is an error: WorldInitEvent cannot be triggered asynchronously from another thread.
Is there anything where I can instantly start coding and not setting up all the stuff to make a plugin?
Also there is Minecraft Development plugin in IntelliJ
I want to Start my Minecraft Server, but when i join i Crash
I have no license
Community version
Is it free?
yes
I'm running all minigames instance without using bungeecord, if I reset my worlds without async task it will freeze a server for several seconds
And can I use community licenses to make plugins
You can't run world creator async sadly
If the worlds are identical or just regen you can template the world, delete it's ID, then just copy it to generate new worlds.
which can all be done async
@supple parcel it doesn't seem as if you return here, why's that?
also, you're not caching the file names, well technically you are but you still loop over every file in the update folder
Does anyone know how to make a piece of paper claim a rank?
you should generate the names once on startup
Because this way it'll still work for the previous setup, of replacing a plugin with another plugin.
And it'll work for the new setup.
So you can add MainPlugin.jar and MainPluginUpdate.jar and it'll do both.
add teh rank to the items PDC so it can't be faked. Then in the PlayerInteractEvent you detect that rank and run whatever code you need to promote them
Idk how to do that
What? It will not preserve the old functionality
It will still continue ahead with the new functionality
Yes
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Im new idk how, do you know of any plugins that do that?
Im focusing on python
It won't preserve the old functionality in that you can use duplicate plugin names
It'll always overwrite the files with the same name, then it'll do the plugin names
Do you know any plugins that do this? Im using luckperms for ranks.
nope, lemme add comments to show
no, this channel is for plugin devs
Kk
Yes my worlds are identical but can you please explain how can I load a new world without WorldCreator?
Youstill use worldcreator but the world is pre generated so its faster
I have several worlds with index suffix, I copy from worlds folder and add suffix, then load it using WorldCreator
@supple parcel Added comments
Picture this weirdo server owner, he likes to run two gamemodes on his server. Lets call it SurvivalGames.jar and Parkour.jar
In his plugin directory, he has one file called Games.jar
Currently, Games.jar is running Parkour.
He puts SurvivalGames.jar in the plugin directory, he also puts SurvivalGames.jar in there as well but names it Games.jar
Now when he starts the server, he notices that first Games.jar is copied from the update directory, and deleted.
Then SurvivalGames.jar is copied and deleted
So all of these won't be run?
They will still run but they will be MUCH quicker if the world is already generated
Im currently using a plugin to make ranks claimable, What is the luckperms command to give the player a rank?
new group*
So I should delete the id from a template world (template world as I understood is just a world I want to copy), then I copy this world to my server folder and load it?
yes
create a world, fully load it, then shut down the server.
delete teh UID.dat and copy the whole folder to a backup location.
you never load that backup, just copy it to wherever you want a new wold then load the copy
So worlds without UID.dat are loaded faster right
sorry, this channel is for plugin development, could you ask the same question again in #help-server?
no it's when they are pregenerated they load faster. You delete the ID which is regenerated as a new world
if you keep the ID you can't use multiple copies
teh ID identifies the world
if you delete teh ID it generates a random one when loaded
In my backup folder all ids are deleted, when I want to reset my worlds I unload them, copy from my backup folder and then load again
Thats how you are currently doing it?
Yes
then so long as each backup is fully generated (spawn) it's loading as fat as you can, other then configuring the world to not keep spawn in memory
So I just need to do world.setKeepSpawnInMemory(false) after I loaded this world?
you do it on the backup before you store it
Can I do plugins with the "Licence for evulation purpose only" IntelJ?
Understood, thanks!!
so after you copy/load it doesn;t keep it in memory
Would someone mind going over https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/825/diff#src/main/java/org/bukkit/plugin/SimplePluginManager.java?f=415
I'm not sure who, but one of us needs to take a break.
One of us thinks the code is utterly broke, the other thinks its not.
Yeah i did nobody answered
don;t mess with the days time using a scheduler
all you have to do is add a gamerule
You (The person that wrote the code), thinks it's not broken
I (The person that didn't write this code), thinks it's broken
Details are important :D
use the game rule DO_DAYLIGHT_CYCLE or what is it called
?img
Not verified? Upload screenshots here: https://prnt.sc/
SCREENSHOT: https://prnt.sc/xvn1nL4b0d42 Where do I put my code for the plugin and how do I get the jar file that I can put in the plugins?
Do I put my code in the plugin.yml?
Yeah /s
Not verified? Upload screenshots here: https://prnt.sc/
https://prnt.sc/-Y0JbIW6fiJD do I need to change anything here? or can I just leave the code and put my script under it?
or delete it?
and how do I get the .jar file
Add the directory to a zip file and rename it to jar /s
why the heck is your main class called spawnerplugin.spawnerplugin.Spawnerplugin lol
for weather there's the gamerule doWeatherCycle
weather and time of day separate
If disable the weather cycle, and set the time to 0, it will be perma day with no rain
Too old! (Click the link to get the exact time)
weather cycle was added in 1.11
rate my debugging skills
10/10
I just System.out.println(1);
would print again
?img
Not verified? Upload screenshots here: https://prnt.sc/
Can I delete this: https://prnt.sc/GJuZgFHRSq2h and put my code inside or do I put my code for the plugin under it?
you can listen to WeatherCHangeEvent and cancel it if the new weather is rain
that's even available in 1.8
what do you mean, you can to set up your plugin in the methods it created for you xD
yesssi fnially working
you can delete it if you want, but youll need to add it back for any initialization anyways
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
It depends on what you're doing for a raytrace, and how often
Hey guys, I'm using this code to replace a crossbow with a loaded crossbow, and a loaded crossbow with a crossbow on left click:
if(player.getInventory().getItemInHand().getType() == Material.CROSSBOW){ if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) { ItemStack loadedCrossbow = new ItemStack(Material.CROSSBOW, 1); CrossbowMeta meta = (CrossbowMeta) loadedCrossbow.getItemMeta(); meta.addChargedProjectile(new ItemStack(Material.ARROW, 1)); loadedCrossbow.setItemMeta(meta); if(player.getInventory().getItemInHand().equals(loadedCrossbow)) { player.getInventory().setItemInHand(new ItemStack(Material.CROSSBOW, 1)); } else { player.getInventory().setItemInHand(loadedCrossbow); } } }
It works well, but instead of doing this I want to just change the metadata state of the crossbow instead of replacing the item itself.
When I try this I get errors, and I am told it is because I am trying to cast class to object, or object to class.
What is wrong there and how would I go about fixing it?
Lets assume you're starting at Location1 and ending at Location2, a vector with a multiple of 0.2
Honestly I'm not really sure, it highly depends here on how fast you can fetch a world's block at XYZ cords.
And you'd want to definitely cache stuff.
I thikn there's also raytracing in the nms, but I'm not going there
don't use setItemInHand (which is deprecated anyway) but just set the itemmeta to the crossbow they already hold
I tried doing that but when I put in the parameters for .addChargedProjectile it gave errors.
You said that it was because I was trying to cast a class to an object or something?
@EventHandler
public void chargeCrossbowOnLeftClick(PlayerInteractEvent event) {
if(event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) {
return;
}
ItemStack itemInHand = event.getItem();
if(itemInHand == null || itemInHand.getType() != Material.CROSSBOW) return;
CrossbowMeta meta = (CrossbowMeta) itemInHand.getItemMeta();
meta.addChargedProjectile(new ItemStack(Material.ARROW));
itemInHand.setItemMeta(meta);
}
You said that it was because I was trying to cast a class to an object or something?
it's because you haven't understood the difference between classes (ItemMeta, e.g.) and instances of that class (e.g. ItemMeta myMeta)
So I have to convert the class to an instance of that class before I try and cast it?
no
Object in java and class in java with real time examples, state, behavior, identity, method, anonymous object and more.
ok
a class is e.g. Human
an instance of that class is e.g. mfnalex
you can do mfnalex.setHealth(...) but you cannot just do Human.setHealth(...) because - how is java supposed to know WHICH human you mean
np
or maybe here's a shorter explanation https://stackoverflow.com/questions/1215881/the-difference-between-classes-objects-and-instances
in your case, you cannot just do CrossbowMeta.addProjectile(...) because you have to call it on a SPECIFIC crossbowmeta - the one you get from myItemStack.getItemMeta()
yeah that kinda makes sense now ty 🙂
np
?paste
Interesting book
Name of book?
Is @tardy delta pretending he can read again?

By whom?
No pictures or pages to colour
Wait birds can read and code
We are all doomed
Anyway fourteen you should read effective java whenever you get the chance to
And the design patterns book
Those 3 are very useful
i have some site for design patterns https://github.com/iluwatar/java-design-patterns
its fairly limited but we are going to discuss them in college next year anyways
probably
Who wrote the clean code book you’re reading? Out of curiosity
bookgpt

Robert Cecil Martin
#include <vector> dumb
figured that out yes
qualified name is not allowed smh
i wanted to do smth with llvm but i better learn some more c++ 🥲
its a joke
shouldve put a laughing emoji behind it
Does anyone know why StructureManager not work with any .nbt files for structures?
errors?
?jd-s
What is your errors?
How are you doing it
What are you doing
What are you saving
How are you saving
sorry am back discord was being stupid
I'm fairly certain I know his issue but until he shows an error
java.lang.RuntimeException: java.util.zip.ZipException: Not in GZIP format
at me.viciscat.mineralcontest.MineralContest.onEnable(MineralContest.java:32) ~[mineral-contest-1.0-SNAPSHOT-shaded.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:279) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:192) ~[paper-1.19.4.jar:git-Paper-477]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.19.4.jar:git-Paper-477]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugin(CraftServer.java:555) ~[paper-1.19.4.jar:git-Paper-477]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugins(CraftServer.java:466) ~[paper-1.19.4.jar:git-Paper-477]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:638) ~[paper-1.19.4.jar:git-Paper-477]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.19.4.jar:git-Paper-477]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.19.4.jar:git-Paper-477]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1104) ~[paper-1.19.4.jar:git-Paper-477]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-477]
Caused by: java.util.zip.ZipException: Not in GZIP format
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165) ~[?:?]
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79) ~[?:?]
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91) ~[?:?]
at net.minecraft.nbt.NbtIo.createDecompressorStream(NbtIo.java:49) ~[?:?]
at net.minecraft.nbt.NbtIo.readCompressed(NbtIo.java:53) ~[?:?]
at net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager.readStructure(StructureTemplateManager.java:231) ~[paper-1.19.4.jar:git-Paper-477]
at org.bukkit.craftbukkit.v1_19_R3.structure.CraftStructureManager.loadStructure(CraftStructureManager.java:145) ~[paper-1.19.4.jar:git-Paper-477]
at me.viciscat.mineralcontest.MineralContest.onEnable(MineralContest.java:26) ~[mineral-contest-1.0-SNAPSHOT-shaded.jar:?]
... 12 more
filtering is when you want to replace values in your files, like version etc in plugin.yml
But, it results in every file in resources to be opened and searched before packaging.
This corrupts zip file formatting
coulnt u manually define files to skip?
not sure tbh
i can helb
If you need filtering add an exclusion/inclusion to it so you only process the files you want
😐
same error
?paste your pom
well i just wanted to create some language actually 💀
dang
in a university
looks fine, you probably need to clean package
how do you do that?
what IDE?
intellij IDEA
in maven window, lifecycles, double click clean
just hit ctrl twice and type mvn clean package
then package
smth with easter eggs
This is my sample resources https://paste.md-5.net/sawibeyeba.xml
also i take shaded jar, should i not be doing that?
anyways now my error changed but that's just me being bad at coding
thanks for the help ❤️
and counter of eggs
guy not too long ago shown a video of him making a sheep screen
?
smells like a teletubbie
oof
or however you write that
should i clean everytime before i package or just every now and then?
I always do to be safe
clean removes old build files so you don't get left over data from previous builds
also what's the difference between shaded jar and not shaded? Google uses words that confuses me
shading = including libraries in your final jar
shaded includes any dependencies you set to be included (shaded) into your jar
Eclipse
you can make a build config and put both in it XD
hehe
Elgar, don't lie to me
a should i take the shaded jar or no?
true
ohhhhh
if ur shading libaries that you require, yes u should use the shaded jar
why don'tya use Intellij XD
else there is also no point in shading
You currently have nothing shaded
Using clean all the time prevents maven from speeding up compiling after the first time. Use clean when you encounter issues with the final jar
I actually have IntelliJ ultimate... It keeps freezing
Was thinking about changing ide
I prefer Eclipse
pc issue :d
im lazy XD
Netbeans is good
well, I don't have any other pc... gonna change ide xD
hmh, never heard of it
Md and myself use netbeans
sure its not running out of memory?
my intellij freeze sometimes XD
It says that but I've already tried to set the memory limit to 4096
gonna try with 8192
maybe it need even more 😄
wtf
i trace for it actually, it ate my CPU resources
intellij is heavy af
then you have alex who gives it 32 gigs
it'll be better if udon't use snippest hahaha
but that only happens when i was writing spigot but not fabric haha
2020
No, use jvm flags like you would an mc server
I have multiple installs
i just upgraded to 2023-03
"supported"? It does what I want for those projects. No need to break it if it works
gimme free c++ lessons
C++ is just java
but also not java
Just remember to write your own garbage collector
nah
just switch to ~Class() instead of Object#finalize()
std::unique_ptr kek
and start using header files for extension
and from static imports use namespaces
like
#import <ostream>
using namespace std;
int main() {
cout << "";
}```
trying to figure out what thiis means
public:
virtual ~ExprAST() = default;```
maybe
Run code when the object is freed
who knows
virtual methods
virtual, can be overloaded (@Override basically), default is just the standard compiler impl
iirc
Thats the destructor of a virtual class named ExprAST
Haven't used C++ in a long while
and if you dont put virtual, you cannot overload it?
yeah iirc
Virtual means its a function that is declared in a base class and is overridden
also @tardy delta, never ever use using namespace
it removes the need for std::, but it also makes everything harder to read
you can still overload(not override)
ik
Default is to tell the compiler to independently generate the class function
yep
imma watch some yt vids ig
Do you have to use C++ or do you just want a low level language?
i just want to learn it
Rust is a better low level language all around in my opinion
what have you said
Writing C++ is a gross experience
i have tried rust but the syntax is weird sometimes, although there are some things i really like
like the enums
npe? ah cant read
Ive written C++ for about a year because i needed low level implementations
of neural networks. Hated it to the guts.
changing weather calls that event ig