#help-development
1 messages · Page 1504 of 1
Oh
the player could die
the lib? if you're talking about red's txt lib, it just checks all slots each tick
sort of, but only on paper iirc
you generally don't need an event for it, though
schedule a task that runs every tick
HAHAHAAHA
That's like shooting yourself in the foot tbh
throw some rotten tomatoes at him
it shouldn't show null as it's set to 0
would you like to join the 1.8 support discord
lmao
u didnt set it 0
now that we can send links here
theres no where in code u did
I did
u didnt
int kills = 0;
KILL
no its set someone where else
where
do u even put it into the map?
omg its so hot today
its says online its 16°C
its like hot as shit
it feels like 100°C
Do custom recipes show up in the book if you have all the items in your inventory?
wait custom recipes show in the book
uh no where 😦
Quick question: if i make a "custom" craft by just making the vanilla recipe, but adding something else as product, will that override the vanilla recipe?
XD
if you don't register them, they aren't craftable
answering to the other dude
Oh
ok
Would every 10 ticks still work fine?
And save resources a bit?
yeah, should be fine
also, if you have lots of enchants that do a similar thing, don't make a new task for each one
the only costly part about what you are doing is the getItemMeta call that needs to happen for the containsEnchant call
which means that you should only call getItemMeta once
is it better on the server to stuff a bunch of stuff into one task as apposed to having multiple tasks?
or as few times as possible
it depends on the kind of stuff and the amount of tasks involved
Would every second still be fine?
hm
I mean
It's not like it's going to be a PvP thing where they have to stop flying instantly when they go into an area
make it configurable and forget about it
So it's probably fine, and I'd assume the chance of someone landing right on the second is pretty rare
time.run() is showing is invalid
you do realize i have zero context for what time.run is or what you mean by invalid
lol, sorry
Cannot resolve run from time
int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> time.run(), 0L, delaySeconds * 20)
and what is time.run() supposed to be
man I don't like json
json is nice what do you mean 🙂
Uh
no not friendly
How so?
but my code doesn't work
Ignore that
json legit has like 4 characters
XD
and then its mostly strings and things
yes
"json": {
"is": "cool"
},
"yes": {
"or": "no"
}
}```
How are you reading it? Like line for line?
uh
json is not for configuration, but for storing data like in your case
I deleted it
IDk if you use it but look into json serialization and deserialization
never have a issue after that
not a big fan of json
json is fine
So with my code i have serialization and deserialization all i do is pass into a code block and it sets it to the proper location in the class, and boom always works
when I say and speak Json I say Johnson
nobody says it that way lol
yeah
jay son
you guys are weird
jay's son (jk)
what happened to tommy tom tom
that moment when entity checking has issues in async calls in 1.17 RIP my log lol
i can't find the right tom in the user list
the deer guy
i think his nick was iliketocode
his discriminator was 3111
jo
this is more of a maven question but how do i force the latest gson version i added as a dependency, bc when i cpackage the plugin and run it it says method deffinition not found
and is that a good idea
<version>latest<version>
you want to shade and relocate if you want to use something other than what spigot uses
@wraith rapids alright, I'm stuck, how do you make a task?
i have the shade plugin
they need to
but it is still defualting the older version
we can't have comments in configs properly because we use ancient fucking snakeyaml
shade and relocate
apparently md_5 is doing something about that
thats what i saw on the thread
but thats for 1.17
l
how do i do that
grab all the files and stuff them in ur project (jk idk how)
google "shade and relocate maven"
literally on uni they explaind us maven as you copy paste stuff and ti works, but i know from making random shit in java that is never true
and here i come again with maven issues
yeah, you just need to find the right things to copy paste
and maybe tweak a few values here and there
i mean maven is pretty pointless what it does is u could do it manually but its just a little harder i mean i guess its pretty useful if ur lazy like me
literally using the second latest snakeyaml and were using the latest one except its bugged
make a custom snakeyaml then and fix the bug :)
yeah no I can't get my json to work
whats ur code
consider improving the unemployment rates
md_5 u need more devs
the person that added comment support to snakeyaml did it so they could add it to spigot and theyre aware of the issue
md_5 u sure u dont have a team of devs?
is 192.168 the starting for all private ipv4s?
?
10.0 too
public static void loadPlayerData() throws FileNotFoundException {
File tempFile = new File("playerDataStorage.json");
boolean exists = tempFile.exists();
if (exists == false) {
try {
File file = new File("playerDataStorage.json");
} catch (IOException e) {
e.printStackTrace();
}
try {
Path path = Paths.get("playerDataStorage.json");
Files.write(path, "{\"1\": \"/\"}".getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
File file = new File("playerDataStorage.json");
HashMap<String, String> newPlayerData = new Gson().fromJson(new FileReader(file), HashMap.class);
playerData = newPlayerData;
}
public static void savePlayerData() {
try {
String jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(playerData);
Path path = Paths.get("playerDataStorage.json");
Files.write(path, jsonString.getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}```
pretty sure you can just write directly
to a file
instead of getting string?
or am i wrong
lol
imagine if used on a big server with tons of players, ram would be full of useless data
Yeah you can
why is the name key for the "PLAY_ONE_MINUTE" statistic wrong 🙃
How do I make a task?
Hello guys! Can someone help me with a problem please?
@EventHandler
public void onBreak(final BlockBreakEvent e)
{
final Player p = e.getPlayer();
if (p.hasPermission("lobbycore.build")) {
return;
}
if (worlds.contains(p.getWorld().getName()))
{
e.setCancelled(true);
p.sendMessage(ChatColor.translateAlternateColorCodes( '&', this.getConfig().getString("NoBreakMessage")));
}
}
i don't know why but i get the message twice when i break a block
if not he could atleast set every variable used in that to null at the end so atleast it isnt a lot of data
Can you please help me with this I really don't like json
that isnt json
thats java
lol
also i think Paths.get() starts from root directory u might want it in ur plugin directory that gets created if u have config files and shit
screw it
you'd use File#toPath then
🤢
I use BufferedWriter but yeah
first thing i copied lol
if you're not gonna use a twr at least put it in a variable and close it manually
im just gonna use mysql
mysl is harder
yeah because that's way fucking easier than writing to a file
this is not to do with json or yaml or toml or a properties
this is to do with learning a library, an API and learning how to use the tools at your disposal
u should probs use yaml instead cuz spigot has a thing for it
Literally I have never worked with json
well i just didnt include that lmao
it was just the method
ok
see if you can find iliketocode on this guild
lmao did he get banned
who knows
looking in message logs it looks like it
?paste
why did he get banned
@wraith rapids would this work for the loop to check the chestplate?
https://paste.md-5.net/etezuxirim.java
i think it was like !tom or something
no he had like a deer avatar
alr
they're no longer here
why
I cant find anything public for a ban or kick cmd
they just left I guess
i can't find any messages from him
add them as a friend then
oof
found him verifying himself
@quaint mantle
doesnt it appear the same for banned account users?
i'm not sure if that is the same account though
that is the only message I could find
all instances of him being mentioned or talked to have no messages by him sent in the timeframe
if his accounts deleted wouldnt all messages be deleted?
its the same for bans too
if you get banned, the admin can choose whether to delete your messages or not
thing is the message is from the deleted account
in a time frame
the message of him verifying himself
by default and usually all messages are deleted
Asking again, why is the namespaced key for the play time statistic wrong 🙃
Why does this let me fly at first, then stop me from flying when I'm wearing the chestplate with the enchant?
https://paste.md-5.net/sucelozoci.cs
maybe player.getPlayer().getInventory().getChestplate() is null?
That doesn't make sense when it's finding the enchant and letting me fly
And getting past that to turn fly on in the first place
Is there an event where I can get an iron door from a button when pressed
Basically like a command block giving you the item when you give it a redstone signal (like hitting a button that leads into it), right?
Or do you mean getting one placed as a block?
why are you getting the player from the player
Because I had to use Bukkit.getOnlinePlayers() for getting the players
also this is definitely the best way to do custom enchants 😆
and player is already a player object
How else are you supposed to detect when the player has the enchant and then toggle flight?
Looks like another library
Yep
how do i turn a block into ice?
i tried using loc.getBlock().setType("ICE");
but it doesnt work
you cant use strings
thanks!
np
Pulse pro
help me out in help-server please
Caused by: java.lang.NoSuchMethodError: 'com.google.gson.JsonElement com.google.gson.JsonParser.parseReader(java.io.Reader)
All i did is add the latest gson as dependecy, bc i need it for the api call
lmao
so what i have to add to pom.xml to fix this?
How come the folder & file aren't being created ```java
public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
public void writeJSON(String fileName, String subPath, String object, String value) {
JSONObject main = new JSONObject();
main.put(object, value);
try {
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {}
}
no errors
on linux?
e.printStackTrace() 🤦♂️
u catching the error so it isnt crashing but ur not even printing the error so thats why u arent getting a error
bruh
sh
error is here ```java
database.writeJSON("playerData", "data", "first", "second");
java.lang.NullPointerException
database is null
u never set database maybe?
You probs dont connect to it
lol no i think database is a class with the writeJSON
^
what a weird naming scheme rofl
want me to name it JsonHandler?
rename it to bob
anyways that isn't the issue
the writeJSON is what makes the file
maybe main is null?
well that line is in the main class
send the full error
no i meant in the writeJSON thing
line 18 in main
^
the only possible reason to that is literally database being null
or something in writeJSON throws some npe
no database is null
Mhm
What is line 18 in main?
he posted it above
oh
But anyways jtx you should always provide the entire class and errors from the very beginning, it will make it easier for other people to aid you
Does anyone know what these enums are telling me? I originally thought they were to do with what a moving object had hit, but after trialling it, it doesn't appear to be correct. Are they to do with the type of moving object instead? (This is in the MovingObjectPosition class of NMS) https://gyazo.com/1e3616547b86983567a8986cd148694b
I did
This is not the entire class
how come?
Or nvm was looking at wrong stuff
but anyways you still havent sent the entire class so cant help you
public class Volzo extends JavaPlugin {
private JsonHandler jsonHandler;
public void onEnable() {
jsonHandler.writeJSON("playerData", "data", "first", "second");
}
this what I use
private void loadConfig() {
try {
if (!getDataFolder().exists()) {
getDataFolder().mkdirs();
}
File file = new File(getDataFolder(), "config.yml");
if (!file.exists()) {
getLogger().info("Config.yml not found, creating!");
saveDefaultConfig();
// set default values
} else {
getLogger().info("Config.yml found, loaded!");
// set values here
}
} catch (Exception e) {
e.printStackTrace();
}
}
you probably need something like:
private JsonHandler jsonHandler = new JsonHandler(this);
also I suggest learning java by taking a course, it will help you with all these crucially trivial errors and will also save everyones time
?learnjava
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.
nope
is there a way to place naturally like there is to breakNaturally
Yes you need to initialize the field
Yes, but you need to fire an event to see if it gets canceled first
But since I don’t know how your JsonHandler class is looking I can’t tell you how to do it
its right here
that is not the entire class
public class JsonHandler {
public Volzo plugin;
public JsonHandler(Volzo plugin) {
this.plugin = plugin;
}
public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
public void writeJSON(String fileName, String subPath, String object, String value) {
JSONObject main = new JSONObject();
main.put(object, value);
try {
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
``` is that better 🙂
yes you're doing it wrong again
have you considered not using 1.8
perhaps consider considering it
I will never, 1.8 is my home
1.8 api sucks
update it then
if you were on even a remotely modern version, you'd do what you're trying to do in like 3 lines
no, that's not my job
backporting features to the 1.8 api is the job of you 1.8 plebians
something you have been failing to do for the last 6 years
and will fail to do for the next 6 years
lmao
what did I do wrong 🤔
No idea, you could look through the other NMS source code though using a "search" feature in your IDE or something 🤷♂️
fields are initialized before constructors
but by a rough guess you don't understand a thing of what I just said
protip
wait
make fields final
I think I fixed it
it'll help you
public void writeJSON(String fileName, String subPath, String object, String value) {
JSONObject main = new JSONObject();
main.put(object, value);
try {
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
}
``` better?
try with resources
you need Bukkit.shutdown() somewhere in there
the entire issue exists in the class not that method particularly
probably doesn't even exist on 1.8
it does
alternatively Thead.sleep(Integer.MAX_VALUE)
back before 1.9 you had to pull the plug from the machine to shut down your server
or Runtime.getRuntime().halt(69)
Again, if you're not going to be helpful, shush
no
it does actually lol https://helpch.at/docs/1.8/
doesnt mean if you are a gecko you can save 15% on car insurance
insurance is for pussies
my plugin doesnt work somehow, maybe my code is the problem... on the console it loads it normally.
"hurr durr look at all this malwar guise!!"
line 8?
again, field initializers are called before your constructor
you have a field plugin
and you are assigning it in your constructor
but you are accessing it before the constructor is called
`public void onHit(ProjectileHitEvent e) {
if (e.getEntity().getShooter() instanceof Stray && e.getHitEntity() instanceof Player) {
Player a =(Player) e.getHitEntity();
double x =(a.getLocation().getBlockX() -1);
double y =a.getLocation().getBlockY();
double z =(a.getLocation().getBlockZ()-1);
setblocksstuff(x,y,z,2);
setblocksstuff(x,y+1,z,2);
}
}
private void setblocksstuff(double x,double y, double z,double ancho){
Location loc = new Location(null, x, y, z);
for(int j=1;j<=ancho;j++){
for(int i=1;i<=ancho;i++){
loc.setX(x+i);
loc.getBlock().setType(Material.ICE);
}
loc.setX(x);
}
//loc.getBlock().setType("");
}`
therefore it is null
amusingly, there actually is or well.. was a lot of malware.
Almost 400 resources deleted that were just malware 🤷♂️
again, make it final, it'll tell you what to do and save you from a headache
yeah but what if i want to download malware
Malware's not going to be left up 🤷♂️
but i want malware
oh well
Perhaps there should be a list of guilty plugins/parties to make it harder for them to appear again.
yeah because that has ever worked
@eternal oxide
https://www.spigotmc.org/threads/list-of-found-malware.389467/
Guilty parties is less likely though
the moment you put a name on a list the name will be changed
nice
it doesnt do anything...
perhaps you didn't tell it to do anything
computers only do what you tell them to do
I'm good, none of my plugins are on there 😄
can you help me figure out what is the error on the code?
does the code run
@vagrant stratus LMFAO
do you have @EventHandler
i posted the code above
do you have @EventHandler
:p
yes
are you talking about these? File file = new File(pluginFolder + File.separator + subPath + fileName + ".json"); File filePath = new File(pluginFolder + File.separator + subPath); ?
add broadcasts throughout the code and see which print and which don't
public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
Hey, so i've been trying to make a custom defence stat. I figured out the equation for it, but when i put the numbers through it, it doesn't seem to work.
how so? (im new to all of this)
Bukkit.broadcastMessage
damage is now (before def) is the damage before defence is calculated
in doing so, you are using the value assigned to the plugin field
by calling this.plugin.getDataFolder()
DMG = [number] is the damage when defence is calculated
Is there something wrong with my equation?
however, since this is declaration-assignment, the value of plugin has not been assigned yet; it is assigned in the constructor
which, again, is called after field declarations
(Also ik that dmg before def is 6.25 and after its 6, but thats because I rounded it up)
you are referencing a variable before assigning a value to it
i can't put it any simpler
learn java
?learnjava
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.
I do this with all my projects and I have never had a problem
you are doing it differently
Is there any problems with this equation?
When the system.out prints, the number doesnt change at all.
integer division in a floating point context
differently from what
Wdym by that?
from how you usually do it
I should change totalDef to be a floating point number?
none print.
` @EventHandler
public void onHit(ProjectileHitEvent e) {
Bukkit.broadcastMessage("HIT!");
if (e.getEntity().getShooter() instanceof Stray && e.getHitEntity() instanceof Player) {
Player a =(Player) e.getHitEntity();
double x =(a.getLocation().getBlockX() -1);`
you should change that division to change in a floating point context
did you register the event
you could for example cast totalDef to (float) immediately prior
Do you just want me to put this.plugin.getDataFolder().getAbsolutePath(); instead of setting it to a variable
wdym
no, I want you to do the things in the right order
right now you are doing them backwards
Literally I don't think that's the issue
html isnt a programming language lol https://www.youtube.com/watch?v=wvDFdfJtSJw
Everybody likes tier lists. Right? In this video I am going over all of the languages that I have experience with and have used to determine once and for all what the best and worst programming languages are. This video is of course purely for fun, and should not be taken seriously.
🌎 Find Me Here:
My Courses: https://courses.webdevsimplified...
neither css
XD
they may not be turing complete but they are still languages
languages u see they say programming languages
not lauguages
ik there are still languages thi
How am I doing it differently that's how I always do it
you are doing it differently such that it breaks
i don't know how you do it usually
why do u use path
oops
not u
but
other guy
Where's the best place to find people who can do some coding work?
cause he's a noob and doesn't know what else to use
not here
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Ty
@undone axle ❤️
I gotta get a project remade somehow :/
but the thing @next stratus everyone isnt gonna do it for free
I know.
Whats better performance wise? List<Location> or Location[]?
I'm gonna pay.
latter
wat
So list?
if i knew more about programming i would do it for free but sadly i aint good
Oh... first is usually top rung lol
Your saying this is backwards so you want me to do this ```java
this.plugin.getDataFolder().getAbsolutePath(); = public String pluginFolder
no
like wtf
JavaPlugin#getDataFolder
jtx the problem is the instance variable plugin
that's all you need
it isn't initialized thus null
oh that
and make sure ur data folder also exists
but if ur making files - please don't use File#getAbsolutePath
just use the normal file reference
now
It's too big to be free
...
do you know what a constructor is?
I've updated almost all my packages to the new version!
thing is if i knew more programming i would do it for free cuz im bored lol
bob the builder is a constructor right
yes
No but, the thing is the project I'm I need of is too big to be free.
lol what is ur project?
yes
just curious
right
so
you have a field
and you have a constructor
you have some code in both
It's a custom mine system
right?
I just can't work with the 1.17 lighting packages
yes
you have this.plugin.getDataFolder().getAbsolutePath() in the field
are you saying I don't need public JsonHandler(Volzo plugin) {
this.plugin = plugin;
}
cool
u do
no, i'm not
listen
you have
this.plugin.getDataFolder().getAbsolutePath()in the field
do you acknowledge this
hm
you have this code in the field
The previous dev won't hell me anymore
this runs when the field is declared
a field
and in that field
ur referencing another field
which isnt initialized yet
does jtx even know java
now
you have a constructor
you still know what a constructor is?
or did you manage to forget
yes i know what it is
mhm
now
let's look at these two bits of code
String path = this.plugin.getDataFolder().getAbsolutePath()
and
this.plugin = plugin;
do we see a relation here?
oh remove this.?
no
how do i register an event?
the first line of code relies on plugin
NNYa you havn;t explained the init order of objects
ya
you need a value in plugin
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so you need to assign the plugin variable first
before running that code
because otherwise it's null
right
yea you've lost me
do you know what a variable is
yes
mhm
its legit this.registerEvents(new AEventClass()); (in main file) liek bro
wat
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Anyone have any idea why this turns flight off when I start flying?
https://paste.md-5.net/sucelozoci.cs
don't return first of all
this.plugin = plugin;
no, wrong -- you haven't put anything in the variable yet
this puts a thing in the variable
this.plugin = plugin;
if u continue it'll go to the next player in the loop
but you haven't done this.plugin = plugin yet
the field assignment happens before your constructor
try continue instead of return?
then checking again if the chestplate has an enchantment
this.plugin = plugin
@proud basin when a class is instanced its Fields are set, be that null or a value. This happens BEFORE the constructor is called.
an if else instead
Did you have this pretyped out?
wow rude
it's called a leading question
jtx could you send your class so i can see as wel what u doing xd
it's intended to lead you to find the fault in your reasoning
Kind of need to do that
?paste
that's not the issue
ur checking if the chestplate is null then checking again if it contains an enchantment
do an else if instead
also
you have to have
curly braces
because if u dont have curly braces
try java Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { for (Player player : Bukkit.getOnlinePlayers()) { if (player.getPlayer().getGameMode() == GameMode.CREATIVE || player.getPlayer().getGameMode() == GameMode.SPECTATOR) { continue; } if (player.getPlayer().getInventory().getChestplate() == null) { player.setAllowFlight(false); player.setFlying(false); } else if (!player.getPlayer().getInventory().getChestplate().containsEnchantment(Enchants.FLIGHT)) { player.setAllowFlight(false); player.setFlying(false); } else { player.setAllowFlight(true); } } } }, 0L, 10L);
this will run only
that
that's not the thing he's pointing out i believe
could you send the class
?paste
through this
Okay
that is the class he is talking about
@eternal oxide we've told him about the init order of objects 4 times
the issue is he doesn't know what init, order, or object mean
.
@proud basin you can't set your path until AFTER you have assigned a value to plugin.
ok
here
public Volzo plugin;
public JsonHandler(Volzo plugin) {
this.plugin = plugin;
}
public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
public void writeJSON(String fileName, String subPath, String object, String value) {
JSONObject main = new JSONObject();
main.put(object, value);
try {
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}```
so
u see how u initialize plugin right
anyways, i'm out
but then u initialize pluginFolder while plugin is still null
because plugin isn't initialized when u create the pluginFolder variable
I see wher he's confusing himself
so instead of initializing the pluginFolder
outside of the constructor
initialize it in the constructor
after u initialize the plugin variable
he thinks because he put public String pluginFolder = under his constructor he thinks it gets set after.
yeah
imagine if someone had told him that constructors fire after field declarations
so? ```java
public JsonHandler(Volzo plugin) {
this.plugin = plugin;
String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
}
public Volzo plugin;
public String pluginFolder;
public JsonHandler(Volzo plugin) {
this.plugin = plugin;
this.pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
}
public void writeJSON(String fileName, String subPath, String object, String value) {
JSONObject main = new JSONObject();
main.put(object, value);
try {
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}```
no
If he read it and realized
hm
you're initializing it
ah ok
put it in the resources folder
learning spigot the bukkit api and java in parallel is fine
okay
being unable to look anything up or do any of your own learning is less so
package typing an essay
spit it out
uhh i still dont see it
well at least no error pops up just gotta fix it so the folder is actually made
How do i use mojang mappings i want to learn this instead of learning NMS because that is what seems to be recommended now.
there we go
are you using mvn to build or intellij's build artifacts
open cmd prompt and is run java -version
no
just
asking
does it say jdk 16 in there
when i downgraded my jdk to a lower version
i had to move it down in my Path env variable too
not just adjust my java home
gradle
o
interesting the file is not being made inside the folder but outside of it
oh
ok
is this ur shade plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>```
and in the pom.xml
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>```
at the top
https://paste.md-5.net/cakihewake.xml this is how my pom usually looks
ignore there are no repos and the dependency since im using buildtools xd
and the special source maven plugin
I have this ```java
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();
does this
path
exist
like
the folder
create the folder before dong that
set ur java version to 1.8
o
do u have java 16?
@digital plinth still got problems?
did u set ur compiler plugin
it still makes it ouside of it
outside what
the folder
what spigot version
subpath
1.17 im assuming
make sure u have java 16 properly installed and make sure u have the latest maven shade plugin
u probably already have the compiler plugin don't know if it matters as well but
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>```
does it look like that
actually
one second
i've been compiling my plugins with 1.8
give me a sec
ok ye java 16 works for me
ok
so
could u send ur whole xml if that's alright
alright tyty
try adjusting ur compiler plugin
and setting the source and target
see if that helps maybe
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>```
@wanton fjord try the maven shade plugin version 3.2.4
if u havent got that already
oh wait u have latest shade plugin nvm
yeah i didnt see it
yet
lol
i think what it is is somethings in that NMS class doesnt support java 16
.
cuz java 16 is class file major version 60
@wanton fjord can you show the NMS.java file?
in com/craftmend/showsplus/nms/
hmm
whats AbstractFixture and AbstractLaser ?
??
why did he delete his messages
package https://gitmemory.com/issue/SpongePowered/Configurate/204/836536546 perhaps this can help ?
thanks for the effort but it's obvious i wont be getting any help here
sorry man xd
this is interesting tho i'll try this thanks
no problemo sir
damn 😔
well its a IllegalArgumentError in NMS.java
so it might be AbstractFixture or AbstractLaser
or whatever
lol
but i dont know about IllegalArgumentError
so it might be something different
im not doing anything special in those classes they are just abstract classes i highly doubt it's that
and pretty sure the traceback would lead to those classes if they were actually an issue
solved it, it was indeed the version of maven shade
using the latest dev snapshot of it works
Is there a way to disable default join message so I can replace it with a custom one?
wantedEnchant = Enchantment.getByKey(NamespacedKey.minecraft(splitKeys[0]));
Does anyone know the vanilla name for Sharpness? Cause just putting "sharpness" doesn't work for NamespacedKey.minecraft(), but protection worked
Listen to the PlayerJoinEvent and use the setJoinMessage() method to change it
Is this how you make a crafting recipe that takes up the whole table?
recipe.shape(" 1 ", " 2 ", " 1 ", " 2 ", " 3 ", " 2 ", " 1 ", " 4 ", " 2 " );
no
I mean, what I see is recipe.shape( " E ", " E ", " S " );
That's for a sword recipe
yup
"123"
"456"
"789"
wtf
It would be like
E
E
S
several people are typing
You can use more than one line?
wym
Sorry, that made no sense
crafting grid is 3x3
I know... ?
i'd use characters for it anyway so you don't accidentally leave anything, like this https://gyazo.com/71479859bc87a57f4658cbcb9e0c12f1
"123"
"456"
"789"
"123","456","789"
Just confused as to why that sword recipe is sideways, I guess
it's not sideways
I'm getting different results when mapping some things using the specialsource-maven-plugin vs the SpecialSource jar file. With the maven plugin everything maps perfectly, but with the jar file some things end up not mapping correctly. Is there something the maven plugin does that the SpecialSource commands provided in the 1.17 news and announcements post don't?
It looks like it is
I've only made crafting recipes with datapacks before, they don't use it that way
Mojang mappings aren't complete so u will have to do some stuff manually
Ohhh
But it maps properly with the maven plugin
EES
" ","EES"," "
¯\_(ツ)_/¯
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
anybody know why i'm getting the Dependency 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' not found error on those lines? it's in the pom.xml btw
is this in intellij
yes
can you try doing File > Invalidate Caches
and wait a few min and see if error still coems up
Do u have the repository
I hate how you spaced that out lmao
i was following a tutorial and that's how they spaced it lol
ok
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
hmm
Maybe it's cuz of spacing
How can I run a function every time a player right clicks?
i'm gonna try invalidating caches like notprankster_ suggested
Try it like this
player interact event
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
yea that fixed it lol
for reference that above code I sent for the pom is the correct spacing
Elaborate?
there were colors for quite a while
thats what you should be using
No in phone they don't have syntax highlighting
I'm on discord beta
Big flex
if(!player.getWorld().hasStorm()){
player.getWorld().setStorm(true);
}
if(player.getWorld().hasStorm()){
player.getWorld().setStorm(false);
}
``` So i cant get it to stop the storm. when they right click the item it can start a storm if there is none but not get rid of it
why not
World world = player.getWorld();
world.setStorm(!world.hasStorm());```
i dont understand
weird flex but okay
@EventHandler
public void onRightClick (PlayerInteractEvent event) {
Player p = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
p.chat("test");
}
}``` I have placed this in the main plugin class, however, it is not registering the event.
oh u need to mail them to get beta or what
nah you can just signup
like the storm does not clear, but it can start
U have to register it
Oh?
It doesn't auto register
Is PlayerInteractEvent RIGHT_CLICK_BLOCK supposed to be ran when you place down a block?
its when you right click a block
Well it runs either way
oo how
google play store
Sorry, I just started using spigot today, but can you elaborate or point me to some documentation on registering an event
?registerevent
oof Conclure add it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?cc add eventapi <https://www.spigotmc.org/wiki/using-the-event-api/>
i dont need a tutorial 🙄
?cc add eventapi https://www.spigotmc.org/wiki/using-the-event-api/
Custom command successfully added.
hot
?eventapi
Just made sure to get something out of that time I wasted on typing that message
lol
slow typer be like 
This is being ran when I place down a block is that normal behavior?
yes
yes
you are right clicking a block after all
True
Cancel the playerinteractevent if you do not want blocks to be placed
Also, is there any way I can disable the "Build is outdated warning", I do not like waiting 20 seconds to run my server lul
Action.RIGHT_CLICK_AIR
Useless depending on what they want
way they worded it, they wanted it 😉
Is there a way I can like if(placeDownBlock) then return cause I only want right click block
Not really
cancel the event if you want blocks to not be placed
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = event.getItem();
if (item == null) return;
if (item.getType().isBlock()) {
// code
}
}
}
or i think it's possible to cast the evnet into a placeblock event
and then cancel that
Thanks
dont just take that code and use it, make sure you understand it
anyone?
does anyone know vanilla name for sharpness
Oh ya that brings me to another issue about cancelling this particular type of events
im trying to do NamespacedKey.minecraft("sharpness") and it is not working
Is that they dun cancel itemuse
I think thats deprecated
Try damage?
what do i do to get encahntment by string then

