#help-development
1 messages · Page 1436 of 1
do you write half of your plugins in .txt files too
You don't have to like it but you can drop it already
It's been who knows how long and you won't stop bringing it up like it's the only thing I've ever written
no
It’s fine red I only write Skript
The author of Skript must be pretty disturbed of the hate against his creation
lol
Only issue with script is that it’s kinda of a bad way to code
Skript was probably fun to write, but if you are going to use Skript you may as well learn full Java and write your own plugin.
👀 why is there a player command preprocess event listener here listening for "/enchant "
🙉 what is this for, why is it not a command executor
The ability to avoid compiling tho but ye tru
Thought you were able to inject custom cmd executor in that event nny, no?
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
if (event.getMessage().startsWith("/enchant ")) {
boolean customEnch = !CustomEnchantment
.getEnchants(event.getPlayer().getInventory().getItemInMainHand(), event.getPlayer().getWorld(), null)
.isEmpty();
Bukkit.getScheduler().scheduleSyncDelayedTask(Storage.plugin, () -> {
CustomEnchantment.setGlow(event.getPlayer().getInventory().getItemInMainHand(), customEnch,
Config.get(event.getPlayer().getWorld()));
}, 0);
}
}
i see no reason for this not to be a command executor
Yeah looks sloppy
is this to like listen to other plugins adding/removing enchants
This is original zenchantments code, no idea what this does
kinda looks like it's checking whether an item has an enchant before using the command and if that is the case afterwards
and if it changes, it's modifying the glow
My assumption is that it handles removing the artifical enchantment glow to prevent issues with the 0-dura + enchantments hidden flag
Hey, is it a bad idea to have more than 1 command executor in a single class?
for super small and trivial commands, likely not
though i'm not sure if you mean what you say you mean
What I meant is, I set the executor for multiple commands to a single class while registering
Then differentiate them and produce different results based on the label
They are pretty small commands, the only reason I'm doing this is because I couldn't find a good way to share data with the setup I have
Thanks for the help!
mmmmaybe
wdym
i would probably have several inner classes each being command executors that then call on shared logic from the outer class
unverified users can't use the bot
how
get verified scrub
oh ok
ah yeah that's a good idea, i'll try that
or just use hatebin or pastebin or whatever
i'm sure you can find a paste site online
the irony
define "doesn't work"
obviously
nullpointerexception
you are calling a method on a variable or a field that is empty
in xyz.lammetaling.lamabuild.user.FirstJoin.onJoin(FirstJoin.java:16)
FirstJoin class, line 16
i have no clue what it is because you didn't include line numbers
I recommend Java 15+ as they will literally tell what is null
I wrote a method world.addEntity(creature); the creature class is this https://paste.md-5.net/axejovefam.java and there a major error that I can not put in here. but any ways is there some thing wrong or that I am missing?
paste the error somewhere and link it here
ScoreBoard class:
https://paste.md-5.net/hizinutuja.java
JoinListener:
https://paste.md-5.net/banoyepezo.java
this is better ig
either getInstance return value or the ScoreBoard field is null
make them not null
ok
you are spawning an entity in your entity spawn listener
which fires your entity spawn listener
which spawns an entity
which fires your entity spawn listener
hmm ok I get that but then why isn't my if statement event.getEntity() is Creature not working? Does it look for the super class or...
Or does it just not work like that
where is this if statement
the class you linked only has 28 lines
check the instanceof of getHandle
i'm not sure what bukkit does with custom entity types
the LivingEntity object you get from event.getEntity() is a Bukkit wrapper over the nms entity
the Creature class extends the nms EntityCreature class
so bukkit will wrap it with something
@wraith rapids I don't really understand! You said it returns null, but I pasted the code from my other plugin, which works completely fine! No difference
possibly the type obtained from EntityTypes
well nullpointerexception means that something is null
it doesn't lie
split the method call over several lines and see which deference throws it
ok
LamaBuild
.getInstance()
.ScoreBoard
.set(p);
package me.mrs.mykit;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.ChatColor;
public class MyKit extends JavaPlugin{
public void onEnable() {
saveConfig();
}
public void onDisable() {
}
public void starterKit(Player player) {
for (String displayLore : this.getConfig().getStringList("Starter.Item-1.Lore")) {
String displayName = this.getConfig().getString("Starter.Item-1.Display-Name");
Material material = Material.valueOf(this.getConfig().getString("Starter.Item-1.Type"));
int amount = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Amout"));
int slot = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Inventory-Slot"));
this.createKit(player, slot, displayName, displayLore, material, amount);
}
}
public void createKit(Player player, int slot, String name, String lore, Material material, int amount) {
ItemStack item = new ItemStack(material, amount);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
ArrayList<Object> lorelist = new ArrayList<Object>();
lorelist.add(lore);
item.setItemMeta(meta);
player.getInventory().setItem(slot, item);
}
==
I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?
saveDefaultConfig
public void set(Player p) {
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Objective ob = board.registerNewObjective("main", "dummy");
ob.setDisplaySlot(DisplaySlot.SIDEBAR);
ob.setDisplayName("§b§lLamaBuild");
//Team level = board.registerNewTeam("level");
//Team online = board.registerNewTeam("online");
//Team tokens = board.registerNewTeam("tokens");
ob.getScore("§0§9").setScore(12);
ob.getScore("§8➢ §7Dein Rang:").setScore(11);
//ob.getScore("§e" + RANK.getRank(p)).setScore(10);
ob.getScore("§1§3").setScore(9);
ob.getScore("§8➢ §7Dein Level").setScore(8);
ob.getScore("§d").setScore(7);
ob.getScore("§8➢ §7Deine Tokens").setScore(6);
ob.getScore("§d§e").setScore(5);
ob.getScore("§1§2").setScore(4);
ob.getScore("§8➢ §7Online").setScore(3);
ob.getScore("§e").setScore(2);
ob.getScore("§1").setScore(1);
ob.getScore("§b§lLamaBuild.NET").setScore(0);
//level.addEntry("§d");
//level.setPrefix("§e" + LEVEL.getLevel(p));
//online.addEntry("§e");
//online.setPrefix("§e" + Bukkit.getOnlinePlayers().size() + "§8/" + "§e" + Bukkit.getMaxPlayers());
//tokens.addEntry("§d§e");
//tokens.setPrefix("§e" + TOKENS.getTokens(p));
p.setScoreboard(board);
}```
@wraith rapids this is my code now and it still throws error
yes, but what is the error
package me.mrs.mykit;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.ChatColor;
public class MyKit extends JavaPlugin{
public void onEnable() {
saveDefaultConfig();
}
public void onDisable() {
}
public void starterKit(Player player) {
for (String displayLore : this.getConfig().getStringList("Starter.Item-1.Lore")) {
String displayName = this.getConfig().getString("Starter.Item-1.Display-Name");
Material material = Material.valueOf(this.getConfig().getString("Starter.Item-1.Type"));
int amount = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Amout"));
int slot = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Inventory-Slot"));
this.createKit(player, slot, displayName, displayLore, material, amount);
}
}
public void createKit(Player player, int slot, String name, String lore, Material material, int amount) {
ItemStack item = new ItemStack(material, amount);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
ArrayList<Object> lorelist = new ArrayList<Object>();
lorelist.add(lore);
item.setItemMeta(meta);
player.getInventory().setItem(slot, item);
}
==
I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?
set
scoreboard.set
LamaBuild.getInstance().ScoreBoard.set(p);
the ScoreBoard field is null
I also tested config save and config intervention save
to listen to commands you need to implement CommandExecutor
pls help
by overriding onCommand
you are receiving no information because you are not listening to any information
i created class command
you haven't set it as the executor of any of your commands
you aren't setting the class you created as the executor of any commands
the class you created is unused
you are literally doing nothing in your onEnable
your plugin does nothing
I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?
again, you aren't doing anything
give kit with command
your plugin does literally nothing other than reload its own config
ommmm ok
hey, I'm having some issues with the LivingEntity.getTargetBlock() method. The javadocs say that the maxDistance 'may be further limited by your server.' What server setting controls this?
hmm. I've got my max server render distance at 12 chunks, but it's still restricting me to about 120 blocks
hi how i can setup my server?
in the #help-server channel
okay thanks
Hey I'm currently working on a very simple command and it used to work but doesn't work anymore...
package cypphi.randomitemskyblock.commands;
import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class info implements CommandExecutor {
public RandomItemSkyblock main = null;
public info(RandomItemSkyblock main) {
this.main = main;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("randomitemskyblock")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
else {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
return false;
}
}
define doesn't work
don't compare the label
the label is not under your control
the label may be anything
compare cmd.getName()
oh sorry, im very new to this stuff, on what line did I go wrong?
(label.equalsIgnoreCase("r
the label is the alias of the command used
which can be configured by the end user
Hello, a question on a spigot server can mods be added
for example, I may alias your randomitemskyblock command to /risk
and then label would be equals to "risk", rather than randomitemskyblock
and your command executor would fail
compare the command's actual name instead, cmd.getName()
that cannot be changed by the end user
ohhh so it would be if (cmd.getName("randomitemskyblock")) {
cmd.getName() returns a String
you can then compare this string to another string
cmd.getName().equalsIgnoreCase("randomitemskyblock")
oh woops, lemme try that
I followed this tutorial: https://www.spigotmc.org/wiki/creating-external-libraries/
But when I update my pom.xml, I have the correct infos it just cannot find my library, am I missing something?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Hello, a question on a spigot server can mods be added
even increasing the server render to 14 did not increase the range at which it is checked
no
that tutorial is trash
it's probably incorrect to begin with
try a better tutorial
hmm, I updated the code and built it but whenever I use the command I dont get the expected message response, but no error either
package cypphi.randomitemskyblock.commands;
import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class info implements CommandExecutor {
public RandomItemSkyblock main = null;
public info(RandomItemSkyblock main) {
this.main = main;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("randomitemskyblock")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
else {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
return false;
}
}
have you declared a command named "randomitemskyblock" in your plugin.yml
@Override
public void onEnable() {
// Plugin startup logic
getCommand("randomitemskyblock").setExecutor(new info(this));
}
yeah
you can drop the command name comparison entirely
since you are only setting that as the executor of one command, it will only be called when that particular command is used
meaning the command name will always be the same
Hello, a question on a spigot server can mods be added???
no
Magma
well there are some hybrid implementations but they are generally pretty shit and unstable
mohist?
Sortof hacky and inbetween
im starting to doubt if this is even correct because it still doesn't work 😔
@Override
public void onEnable() {
// Plugin startup logic
getCommand("randomitemskyblock").setExecutor(new info(this));
}
did you drop the name comparison
yes it's this rn
package cypphi.randomitemskyblock.commands;
import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class info implements CommandExecutor {
public RandomItemSkyblock main = null;
public info(RandomItemSkyblock main) {
this.main = main;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
else {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
}
well
call info Info
and add some System.out debug messages i guess
see if it's getting called at all
also you don't need to check and cast to player
all CommandSenders have the sendMessage method, so it doesn't matter which kind of CommandSender it is
oh yeah right
do u ever speak in other channels NNYa
ok so I got this now
package cypphi.randomitemskyblock.commands;
import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Info implements CommandExecutor {
public RandomItemSkyblock main = null;
public Info(RandomItemSkyblock main) {
this.main = main;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
this doesnt look very right
(i gtg real quick ill be back in like 5 ish minutes)
there isn't a reason for it to be declared as null exp since it gets defined during the classes construction
other than the null assignment, it looks fine
declaring a field or variable but not assigning anything in it is the same as declaring it and assigning null to it
because null is the absence of anything
oh im back
now you're casting the sender to player without checking that it's a player
what do i do with that null thingy? Do i just remove it? (i kinda dont know what im doing, but thats why im learning)
drop the cast
I think I fixed it all
package cypphi.randomitemskyblock.commands;
import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class Info implements CommandExecutor {
public RandomItemSkyblock main = null;
public Info(RandomItemSkyblock main) {
this.main = main;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
looks fine
do I now just remove that null thing?
you can remove it or leave it, either way it does the exact same thing
assigning it as null may be more verbose for a beginner and be easier to realize that it indeed is naturally null until you assign something else there
so just this is also fine?
public class Info implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
return true;
}
}
oh, I guess I'll keep it then
i'm talking about this = null; exclusively, for the record
public RandomItemSkyblock main = null;
and
public RandomItemSkyblock main;
are the same thing
you should make the field private, however
hey there anyone that knows about pub/sub with jedis/redis? i have created a basic jedis pool with a listener which extends jedispubsub, how would i go about continuing? i want to be able to run public void's on for example server 2 while a player is on server 1. and this would not work with the bungee plugin messaging system since there are no players on server 2
if I make it private it shows errors tho
what errors
public class Info implements CommandExecutor {
private RandomItemSkyblock main = null;
public Info(RandomItemSkyblock main) {
this.main = main;
}
this?
yes
this is now highlighted tho, does that mean anything
read the warning and it'll tell you why it's highlighted
you are never using that field
did you write it yourself or did you copy it from somewhere
I got that thingy from someone else, im not even sure what it does tbh lol (i asked for help and he gave me this and it was still broken)
you removed the constructor so now it doesn't take any parameters, but you are trying to give it 1 parameter
oh what do I do there?
you learn java
fair enough, im tryna learn java through using it instead of watching 10 tutorials and copying code while still not knowing what im doing
you should still read up on some things that explain what things are and what they do
what a constructor is, how to call one, what a method is, what parameters are
fields and what they're used for
just the absolute basics
yeah, I'll do that and come back on it when I know more about it
hey there how would i go about using remote method invocation to run public void's over servers? (bungeecord)
have you tried googling
i'm sure at least one guide for jedis/redis/pubsub exists on the internet
this is like day 5 of you asking this in this channel
yea i have tried googleing lmao. apparently i have to setup a database, after googleing how to do that i haven't found anything
maybe look into sockets
at least those are straight forward
well, straight forward-er
well let's say that i want to continue with redis pubsub. how would i go about making a database. i went to the official redis page on how to set up a database and it looks like i need linux to do that
you need something to host the database on
you can host it from a plugin
or more specifically, you can host it on the same system the minecraft server is on, and run it through the plugin
error: package org.bukkit.entity does not exist
import org.bukkit.entity.Player;
how do you fix this error im using gradle as a bulid tool
having a bunch of similar errors as well
you dont have dependency set up correctly
how do i set that up
this uses maven is it possible to set it up with gradle
google "spigot gradle tutorial"
thx
in the future I expect you to be able to use google without aid
lol yeah
sry
Hey hey! 👋 - Has anyone used Toml before? I can't seem to find an easy /native way to update values
what lib r u using?
so how hard would a custom vault plugin which only accepts certain approved items be? I am considering making this
can you give more concrete context, how is the approval of the items going to work for instance
do you want to update a Toml object or a file?
TomlWriter?
define normal ai
Idk what u mean with "the normal AI"
assuming its not "the default one"
I'm trying to create a plugin which displays a video for a player. This is the concept
The player gets a link from a sector, like /sendvideo @e[region=regio]
The player needs to open the link, when he opened the link, the controller gets to see which players are connected. And the controller can start the video at once so everyone gets to see it in sync
Could this be possible, and how? And do you guys maybe have some link for getting started into this way?
have you gotten the video part done?
cause the video part itself.. is not easy at all
just use pulses media lib
true
My main file https://paste.md-5.net/vozahapazi.java
My class file https://paste.md-5.net/axejovefam.java
So, all of my mobs have noAI but I would like the dafault AI. Is that possible?
Ans sorry for the repost
I don't really know, it's just a random idea I had. I don't usually do things with Spigot, but I have seen it done before in the past with the concept of a 'vault' like this...
I've recently been getting into Fabric modding, though
please help how do i _ _ _ _ _ _ _ _ ?
can someone help me ?
does anybody know how to _ _?
anyone got the offset for a perfectly centered armorstand arm for blocks?
nvm think i nailed it
what version are you using
;-;
i cant figure out why this gives an error on loading:
[tutorial] tutorial v1.0 attempted to register an invalid EventHandler method signature "public static void com.defiantburger.tutorial.events.tutorialEvents.onDismount(org.spigotmc.event.entity.EntityDismountEvent,org.bukkit.entity.Entity,org.bukkit.entity.LivingEntity)" in class com.defiantburger.tutorial.events.tutorialEvents
are you making the event static?..
change public static void to public void
no
cant have (Event, other)
just make it EntityDismountEvent evt
then you can use the event itself to get the entities
XD
thats what i noticed first, didnt even see that comma
@cold tartan
@EventHandler
public void onDismount(EntityDismountEvent event) {
//code
}
use that
then from there you can use getEntity and getDismounted
yea, then youll be good to go 🙂
im moving my intellij plugin projects onto a new drive
any idea how to find all of them
i think they are in different folders
this Listener ```@SuppressWarnings("unchecked")
@EventHandler
public void onSpawn(EntityDeathEvent event) {
EntityTypes<? extends EntityCreature> type =
(EntityTypes<? extends EntityCreature>)
((CraftEntity)event.getEntity()).getHandle().getEntityType();
Creature creature = new Creature(type, event.getEntity().getLocation());
Creature creature2 = new Creature(type, event.getEntity().getLocation());
WorldServer world = ((CraftWorld)event.getEntity().getWorld()).getHandle();
world.addEntity(creature);
world.addEntity(creature2);
return;
}``` is throwing a million errors or reapeat is there anything wrong with the code?
Why is that nms
sorry, https://paste.md-5.net/xuqupavaso.md is the error on repeat
I would still like to know why you’re using NMs
I really don't know I was just altering other people's code trying to understand it along the way
I'm sorry
Yes but I need a way to diffrenciate between the normal mob and the mob I spawned
Give it pdc data
Alright I'll look into that Thanks!
If a player falls into the void how can i get the position they fell from?
like the block they where standing on before they fell
You’ll have to store the last block they stand on in a map
like just constantly store the player's last stood on block?
Pretty much
Just to be clear, the AsyncPlayerPreLogin Event keeps the player in "Connecting to server..." until it's returned, right?
vali
Yes, any code here should be fast
Gotcha, thanks
mrsadeghi1385 issued server command: /gamemode survival
[10:52:32 INFO]: [mrsadeghi1385: Set own game mode to Survival Mode]
[10:52:36 ERROR]: Could not pass event PlayerDeathEvent to MyKit v1.0
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:308) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at org.bukkit.craftbukkit.v1_13_R2.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:434) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at net.minecraft.server.v1_13_R2.EntityPlayer.die(EntityPlayer.java:493) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at net.minecraft.server.v1_13_R2.EntityLiving.damageEntity(EntityLiving.java:1055) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
at net.minecraft.server.v1_13_R2.EntityHuman.damageEntity(EntityHuman.
how to fix this
?
?paste
post the FULL error
The method getPlayer() is undefined for the type PlayerDeathEvent
at me.mrs.mykit.MyKit.onJoin(MyKit.java:54)```
ok
Hello, what is name of plugin, which making big doors, i mean he make door from blocks ? I think I saw this plugin somewhere, but I dont know, whats his name

isworld.spawnParticle(Particle.BLOCK_CRACK,block.getLocation(),10, 1, 0.1, 0.1, 0.1,block.getType().getData());
🤔
The error tells you exactly what you did wrong
well, I assume it does as you cut off your screenshot. Use paste for text not screenshots
i don't understand how to use materialdata
whats the rest of the error
thats not even the same error
oh, sorry I was confused by the first part
declaration: package: org.bukkit, enum: Material
it returns a Class that extends MaterialData
what is your UpgradeCelll.java:111
.
oh wow, just now i see that i did a typo in the class name
kek
lol
use createBlockData not getData
thats the method i was looking for
how can I check if a player changes his armor?
for example if he wars gold armor he gets a message
There is no complete event is spigot to check whether a player changes his armor. You can check the ways to equip armor though (inventory clicks & player interaction)
But I believe something like Paper had an event for this
Yep no event here either use existing libraries or make ur own
How do i make it so, when a player dies, It drops a specific item
a player head for an example
@EventHandler
public void onPlayerDeath(PlayerDeathEvent death) {
//code
}``` ?
thank you ^D^
Getting an internal error, cant find anything wrong: https://pastebin.com/naG5MZ3F
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
You didn't provide an error, but your code can be simplified by using serialized objects properly. java config.set("spawn", player.getLocation()); //to retrieve Location loc = config.getLocation("spawn");
yh ok makes sense, thank you
You need to return true if your command was processed correctly. returning false results in the command syntax being displayed
why is setMaxHealth deprecated and what do i use instead
Did you try reading the docs
Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() were dragonBattle is the battle linked to my World but it doesn’t work
??? dragonBattle.respawn wut
Perhaps try setting setRespawnPhase
lol its actually a api method
Already tried :/
Yes ^^
ok ty
Hey guys so I'm working on a crate for my server, the plugin I'm using is CrateReloaded. I am trying to implement the custom cards I have made in Xen's trading cards plugin into the prize system of the crates. I have been trying to use both item prizes ie. "item:(tradingcards.Blazeborn 1" line for the code similar to the example crates as well as the command line ie "cmd:(/cards givecard Common Blazeborn (cards.givecard)) but every time I use any code line to do with the cards the whole plugin stops working entirely. any thoughts on what I can do to get this to work? I can send ss of code if u want TIA
Someone know a way to send a fake player in plugin development ? like sendblockchange() but for player to send a fake location
Use the citizens API
ok thx
Or manually set up the PacketPlayOutNamedEntitySpawn
What the falues at the end means? ```java
fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);
whats fireblock
FireBlock is fire
It's literally the fire
in Minecraft
When you set something on fire, you technically place fire block
are you sure ur using spigot
show the code
it doesnt exist in the spigot doc
fireblock is vanilla thing
you mean nms
in that case its up for you to find out,the code is obfuscated so its more of a eyeball
post how you get fireblock
import net.minecraft.block;
What do you mean?
for example
Location from = event.getFrom();
the cast is Location
is the type of your variable
if its that hard to post how you got to fireblock i wont bother looking into source to see the values,fairly simple
I see it
I don't have anything like it
I just did import net.minecraft.block; and fireblock now can be used in the class
just paste the whole method where you are trying to set fireblock
let me guess hes gonna paste the import again
im guessing that fireblock is a package
within which
is all the fire stuff
the fact that it's not a class or anything
unless its a wierdly named static class
yeah no ideea where its from as hes not posting the actual code
only the method
fireBlock doesnt come out of nowhere,you initialized it somewhere
import net.minecraft.block;
public class FireBlock extends AbstractFireBlock {
public static void bootStrap() {
FireBlock fireblock = (FireBlock)Blocks.FIRE;
fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);
}
}
I was hoping when I change 60 or 20 to like 999999 I will make fire infinite.
Doesn’t 1.16 allow you to set up infinite burn blocks with datapacks
what version is that
1.16.5
Hey, I've got a pretty basic question, I'm trying to check if the player has 64 iron ingots in his main hand, how can I check for a certain value and not just one? My code: ```java
Player player = event.getPlayer();
Material mat = player.getInventory().getItemInMainHand().getType();
if(mat == Material.IRON_INGOT) {
// Do shit here
}
}
item.getAmount
i believe there is a .getCount or .getAmount method or something like that
thanks!
I am not a coder. I downloaded example plugin with example class and I am trying to edit that so fire is infinite.
why are you doing nms then
Idk I found it on google, and it does exist in the obfuscated code somewhere
Idk where
I don't know what nms means tbh
Well FireBlock is their class
yes
Who's
Not really spigot related but more api, however they don't have a discord, maybe someone here knows.
I'm building a phone plugin so people can call eachother, however, currently people who have been muted can call due to the commands.
We use litebans, so I was hoping to use their api to check if the user is muted or not, all good so far.
The only issue I am having is that when using the following code:
if (LiteBansFetcher.get().isPlayerMuted(p.getUniqueId(), "0.0.0.0")) {
p.sendMessage(simCardClass.messages.getChatMessage("messages.muted_player_error"));
return true;
}
the error I receive in console is that I cannot run this in main threat, and need to run it async.
I myself an not that experienced with multiple threats in code, but wouldn't that cause the command to feel slow if I have to pull down every single time who is muted on every single command?
I aint asking for code rlly, more just, would running the check async cause it to become slow af?
Error:
- Caused by: java.lang.IllegalStateException: Database queries cannot be executed on the main server thread!
and where does AbstractFireBlock come from
Also from net.minecraft.block
how do you know that
you have to execute database queries async
I don't. Idea says it is existing class. I copied it from forum.
I know, but wouldn't it slow it down by a lot?
not really
I'm not that sure on how slow async is.
it's basically the same
It does compile tho
but on the main thread, until the query is returned, the main thread hangs
which you shouldn't do
Gotcha, now, running async, is that using a runnable or?
yeah not sure what witchery ur on
I don't understand
you downloaded a already made class by someone
go to the block package
seems like
How do I disable moving a enderegg into a shulker box?
I think there might have been an asyncquery method but I can't remember
I think that woudl be the best way
pseudo code: on inventory interact event, if material.gettype = material.enderdragonegg then event.setcancelled(true)
what name?
I can't find this event
InventoryClickEvent
Yeah that's it
I don't know
I found the obfuscated code
The whole class
But it is mojang code so I am not sure if I can like paste it on pastebin
@young knoll @hexed saddle
@EventHandler
public void shulker(InventoryClickEvent event) {
if(event.getClickedInventory().getType() == InventoryType.SHULKER_BOX) {
if(event.getCurrentItem().getType() == Material.DRAGON_EGG) {
event.setCancelled(true);
}
}
}
Like this?
is it working tho?? or you just have the code
@quaint mantle where did you get the project from
send the github link
With this code, I can put it in, but not take it out
It builds in the .gradle folder or something
I can't change any of the code
send a link to the github repo
you couldve just made that yourself
I don't know how tho
They have an event listener they don’t even register
Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work
I removed event listener
And command
I only kept Main class and deleted most of the code
I just want to make fire infinite
My issue has been solved.
Like so I set one block in jungle on fire and the whole jungle burns down
BlockData -> Lightable -> setLit
declaration: package: org.bukkit.block.data, interface: Lightable
imagine if we had an API for such things
I would have to set every single block to infiburn
nobody cares about bedrock
Can't I just modify the acting of fire so it doesn't dissapear?
we will move to it eventually
we won't
were alrdy forced to move soon to microsoft with our java acc
its alrdy decided
yeah but that doesn't mean what you think it means
You can cancel this event with fire to stop it going out
You check for the inventory type to be a shulker, but when u put it in, inventory type is an inventory
wut
Btw good luck with changing all source codes to Java 16 when 1.17 comes. Every single mod, every single plugin, every single source code of spigot, paper and everything else will have to be updated to Java 16. Sure it might work without it but since Minecraft will support Java 16, I don't see reason why to keep mods and plugins on Java 8
shulker eventually implements Inventory
Because currently most mods and plugins are made with Java 8
You do realize Java is fairly backwards compatible
paper has already pushed for java 11
Yeah but it is stupid to keep it on Java 8
Yes but why would updating to java 16 break things
the only things that'll break are like _ variable names and reflection
It won't but you can do some stuff slightly better
Also 1.17 only forces java 16 on the client
Performance wise
unkown after all the server is also compiled on java 16
if you cared about performance you wouldn't be in this discord
So modifying it with the new features of Java 16 in mind isn't bad idea
from the client
How I did it was this
public void disableEnderEgg(InventoryClickEvent event) {
InventoryType inv = event.getWhoClicked().getOpenInventory().getType();
Material item = event.getCurrentItem().getType();
if(inv == InventoryType.SHULKER_BOX || inv == InventoryType.ENDER_CHEST) {
if(item == Material.DRAGON_EGG) {
event.setCancelled(true);
}
}
}
Anyways I feel like Minecraft 1.17 will run so much better
probably not
if anything it's going to run like shit because of the sound mechanics they added
You seem to think java is some terrible language
But Java 16 has better performance than Java 8
still a single thread process
Java isn’t that bad, minecraft is just a mess
and you can already run the server or client on newer versions of java if you want
I wonder when will this change if ever
1.17 changes literally nothing in that regard
I mean it’s not all single threaded
if it ever happens its gonna be on bedrock
Yeah but the havyest stuff is single thread
but not rly the important ones
not necessarily
paper for example has offloaded chunk loading and generation off the main thread
and light is already on its own thread
like good yeah we have login chat and small things
Mob tracking
we have way more than chat and small things
only the main tick loop still happens on a single thread
But you still need good single thread performance for running 100 people on one server.
obviously yes
maybe theyl scrap up some shitty multithread with that c++
Yeah it is
But the problem is that for example 1.12 spigot runs still better with all the stuff mostly on single thread than 1.16 paper because 1.16 it self is huge mess
that's because mojang is prioritizing shitting out the maximum number of features in the minimum span of time
and so their implementation of everything is super sloppy
well with new stuff comes more performance cost
So even when paper has offloaded chunk generation and other stuff on different thread, it didn't changed much and it still runs mostly same
ofc 1.8 will run much better than 1.16
look at fucking villagers for example
I still believe Mojang could spew out 10x the content if they really wanted to
it took them 2 major versions to bandaid their impact by adding a cooldown on their fucking pathfinding
in a normal world they take ~20-25% of tick
Some paper forks are getting pretty close to 1.12.2 performance
Didn’t mean to mention my bad
1.8 is inanely fast
it's very inane yes
Which ?
Pls just don't talk about Yatopia
That's just shit
Tuinity is pretty good ngl
Send link
use google
The modified one
It’s closed sourced
probably not publicly available
most likely another amazing ultra fast much better performance focused insane performance 500$ fork
scamming at its finest
Btw I don't get it with Yatopia. The idea it self sounds great on paper but the devs are so stupid and they merge stuff they don't even know what it is doing.
wait what is yatopia again?
It’s not as bad as it use to be
$500 1.8 cannoning paper forks
i've heard it's pretty good
it's trash
Looks like it
k boys,now that were all here,lets show our armorstand movement implementations,you go first
The first commit is from 18 hours ago and it is a patch revert
They basically combined multiple forks of paper into one to get the best features from each fork. It doesn't work that well in reality. But it's because the devs don't even know what they are doing.
They don't understand a lot of stuff.
just throw some entity move packets at the player
It's not really
i need to make this shit move https://cdn.discordapp.com/attachments/694661573125472256/842572589620133898/unknown.png
but first im looking if i can get easy way out and yoink a code
before i get to make one myself
If you want Yatopia, you better go with Tuinity or Airplane
i'm sure there is some snippet somewhere but it shouldn't be all that very complicated
sadly not rly
most pets plugin out there are under paywall
no free ones implementing complicated things
Could always mystical mobs for the mob AI
Just decompile a public one
they do extend livingentity
assign each of the components a vector that represents its location from the center point of the entity and then rotate them around as you see fit
then move them all in the cardinal directions and you're done
I've stolen code from a lot of small public plugins
its nothing much of a teleport however
navigation is the problem
so the fker doesnt get stuck in a corner of something
or if it needs to jump,fall down
however 2nd problem is,theyr packets based
so not much AI can be done
leverage existing navigation either by spawning a regular entity and using paper's pathfinder api or implement an entity type and use paper's ai goal api
you can hide the existing entity and replace it with your armorstand shit on the protocol layer
hmm could actually work
will make shit like collisions and hitboxes and everything much more sane
there are two different approaches
I'm too scared to use paper API's
one is to use the pathfinder api to command an entity to navigate to a specific spot or follow another entity
well armorstand is a livingentity i might be able to just slap
the pathfinder on it
if i also add movement attributes and such
and the other is to use the ai goals api and give an entity ai goals like jumping, tracking, fleeing and whatever else is bundled in with the ai routines of the vanilla entities
as well as your own custom goals iirc
hmm guess ima have fun tonight
the latter has a bit steeper of a learning curve and is more limited but it binds into the vanilla mechanics of the server better as you will be simply modifying goal list for the entity
the former is simpler to pull off but requires you to do all of the calculations required to be able to tell the entity to go to a spot you want
f.e finding that spot
think ima go with pathfinder api combined with a packet hack to hide the entity
from there i can simply use the entity location to dictate packets movement
for the armorstands
entity location + rotation
hmm the pathfindergoal should have a waypoint list though
so i should get the angle it should be facing
get the angle it is facing from the packet
why
I am trying to send an actionbar for 1.16.5, but it does not work although it does not give any errors. Can anybody help me?
oh I thought the spigot didn't provide this
Still wondering the reason for this, do you have any idea?
declaration: package: org.bukkit.entity, interface: Player, class: Spigot
You mean POM xd
This isn't your POM
You might want to add some dependencies like spigot
pls give dependencies spigot code
Bro don't ask us to write it for you
Remove bukkit from there
^
and click reload maven dependencies in intellij
and make sure you have the repo added
ok
also theres literally a wiki article on spigot on setting up your project with maven lol
spigot repo how?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ok
Hello, I am new to Java and plugin development, but I know some basics, so I thought I could create some stats plugin. But I have a problem. How can I listen for harvested items, for example to save stats of how many potatoes player farmed? It seems like I cant listen for PlayerHarvestBlockEvent? So what is this event doing? Im getting this error from it: [14:57:37 ERROR]: [FoxStats] FoxStats v0.0.1 BETA attempted to register an invalid EventHandler method signature "public void eu.skyfox.foxstats.events.EventManager.onPlayerHarvest(org.bukkit.event.player.PlayerHarvestBlockEvent,eu.skyfox.foxstats.storage.MySQL)" in class eu.skyfox.foxstats.events.EventManager
Do I have to listen for something else?
do you have you event class implements Listener?
public class name implements Listener
{
MySQL databaze = new MySQL();
public EventManager()
{
databaze.mysqlSetup();
}
@EventHandler
public void onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
{
new onPlayerHarvest(e, this.databaze);
System.out.println("Harvest!");
}
}```
yep
and register event?
yes, in main getServer().getPluginManager().registerEvents(new EventManager(), this);
other events are working fine... just Harvest event seems to by different?
Ok :3 I have to be doing something dumb that I just can't figure out
I have Material import and it can't find Material.RAW_FISH
What do you do with the harvest event?
🧐
{
public onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
{
String item = null;
if(e.getItemsHarvested().get(1).getType() == Material.POTATO)
{
item = "potato";
}
System.out.println(e.getItemsHarvested().get(1).getType()); //DEBUG
System.out.println(e.getItemsHarvested().size());//DEBUG
//write data into database if the harvested item is logged
if(item == null) return;
String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
"VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItemsHarvested().size() +")";
try
{
Statement st = databaze.getConnection().createStatement();
st.execute(sqlCommand);
}
catch(Exception exc)
{
System.out.println(exc.getMessage());
}
}
}```
What is the meaning of harvest?
passing the data into Database.. but it doesnt even get there.. it does not do anything, it is not listennign for that event
farming a crop
yep, it should trigger when someone farms a crop, or potato.. 😄
Does it print those debug messages
Does the crop have to be fully grown?
on server startup, it just says that it failed to register the event
Try messaging the player instead of syste,.out
It doesnt listnen I think
Oh
Oh.... you need to register the listener
I did that. Every other event works
onPlayerHarvest implements Listener
i was register
nonono, that is handled by EventManager
i was implements
by this
I'm new as well ;-;
O.o
like.. idk 😄 https://papermc.io/javadocs/paper/1.16/org/bukkit/event/player/PlayerHarvestBlockEvent.html here is docs for the event.. and interesting is "This event is not called for when a block is broken, to handle that, listen for BlockBreakEvent and BlockDropItemEvent." - but than what is this good for, when you cant listen for it 😂
Oh yea looks like theres more steps better off using BlockBroken and check if that block is a crop
but how do I get how many potatoes were dropped for example? Like.. I still dont understand the meaning of PlayerHarvestBlockEvent, when you cant use it... 😄
Honestly just don't get how many were dropped just disable the vanilla drop and generate 1-3
of a given crop
hmm, mby I could use the BlockDropItemEvent.. But... thats so annoying 😄 there literally exists event specificaly for harvesting crops, but you cant use it.. 😄
Mby someone who understands it better will explain it later.. when he reads it 😄
Ok my program works with Spigot 1.12 but when i upgrade to 1.15 I get that. What changes about Material between the versions?
Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work
<color>_stained_glass_pane
Thanks but y is raw fish wrong then ;-;
<type>_fish
Yes but I want the normal battle of the ender dragon and If I spawn the dragon I will have to recreate the bossbar and replace all the Crystals and I’m not sure if the dragon will have the same behaviour that the classic ender dragon fight
so raw doesnt work?
I see can you spawn one and then run the InitialRespawn()?
It doesn’t work
Is there a function to remove a block from inventory by id and amount?
Already tried
damn
This is the hell lmao
Not sure if that was the problem?
LMAO
the second has same error
check your maven compiler version
should be upper
u have errors in the item stack material
huh
is it working?
Oh well I have other errors but that's gone so pretty sure
ok
Well, I'd use adventure but https://www.spigotmc.org/threads/tutorial-send-actionbar-messages-without-nms.257845/
Did you register the event in onEnable, did you put @EventHandler above the method, and the method won't even work since you're trying to get spigot to pass in mysql database, even though spigot has no idea what it is, you'll have to define the mysql database somewhere else
you shouldnt define it or use the methods?
Well, It works for onBlockDropItem just fine... and on PlayerBlockHarvestEvent it throws an error
:/
What's the error?
do I need to put this inside the onEnable method?
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
event.getPlayer().sendMessage("Welcome to the server!");
}
bcs it doesnt even work
Try getting rid of the mysql part in the event parameters, spigot has no idea what that is
are you implementing listener at the top of the class? i.e public class Plugin extends JavaPlugin implements Listener
^
whoops
and are you registering it properly?
Yes. I have class EventManager, that listens for all the events. And than separate class for every event. The separate classes are called by EventManager, its more clear for me 😅
And I have no problem with any other event, just this one.. 😄
has anyone learned from the channel "Glak Jack" I need to make sure that he is legit
if thats directed at me, I'm not talking about yours rn, I'll have a look in a sec
does the other event interact with MYsql server?
learned about what again?
its prob best sticking to TheSourceCode tbf
they're odd tho
yes, as I said 😄 other events do the same thing with database and they work completely fine
no dont add event managers
oh
weird practices but they teach good spigot stuff
most of the time
thats for people that undersrand the basics
btw, if you never learn Java before, be cautious about YT tutorial, many of them have no clue to do proper Java
^^^
90% of the time
most don't follow conventions either
can you help me whit this error?
https://paste.md-5.net/ufixumuwux.apache
Can you send the method here? Just wanna see if there any obvious differences
so if you're learning I recommend you google java coding conventions and learn from TSC
Also phones about to die
or has anyone learned making plugins from VerveDev
I haven't found a much better option
I know Java but learning programming plugins is much more difficult 🥲
it really isn't
well in the beginning it is
the problem with TSC is their developers all have completely different coding styles, so their tutorials are sometimes really different from eachother
Wait the send button is bluer
huh
Not true imo
they should all have the same conventions
anyone?
yeah discord is ugly now
I use white theme so I don't see much of it
Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work
java is actually probably much harder than plugins than you think
😬
{
public onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
{
String item = null;
if(e.getItemsHarvested().get(1).getType() == Material.POTATO)
{
item = "potato";
}
System.out.println(e.getItemsHarvested().get(1).getType()); //DEBUG
System.out.println(e.getItemsHarvested().size());//DEBUG
//write data into database if the harvested item is logged
if(item == null) return;
String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
"VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItemsHarvested().size() +")";
try
{
Statement st = databaze.getConnection().createStatement();
st.execute(sqlCommand);
}
catch(Exception exc)
{
System.out.println(exc.getMessage());
}
}
}``` here is the method that works
eww allman
its basically the same thing
Bukkit is basically single threaded which can be sort of a relief if you’re new to programming
just another event
Java is very very complicated
but many of that you do not need to much, as other developer abstract it away from you
tbf, most language is very complicated when you tries to do advanced stuff
can someone look over this tutorial and check if it will work?: https://www.youtube.com/watch?v=9_kRspIX2eE&list=RDCMUCDMYO_8-0dY79Y09zxVAIhw&index=9
How to Be Spiderman in Minecraft:
Today we code "Minecraft, But We Can Swing Like Spiderman". A trick using leads, arrows, invisible bats, velocity, and more, makes it so that we can play survival Minecraft without mods and swing like Spider-man.
This isn't really a challenge, it's just a fun thing we added to vanilla Minecraft (this isn't lik...
Java isn’t very very complicated tbf
I mean relative to coding a plugin
{
public onBlockDropItem(BlockDropItemEvent e, MySQL databaze)
{
String item = null;
if (e.getItems().size() == 0) return;
if(e.getItems().get(1).getItemStack().getType() == Material.POTATO)
{
item = "potato";
}
else return;
System.out.println(e.getItems().get(1).getItemStack().getType());
System.out.println(e.getItems().size());
System.out.println(e.getPlayer().getName());
//write data into database
String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
"VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItems().size() +")";
try
{
Statement st = databaze.getConnection().createStatement();
st.execute(sqlCommand);
}
catch(Exception exc)
{
System.out.println(exc.getMessage());
}
}
}```
here, sorry 😄
If you've never done an OOP language before, it can be a lot to take in.
That’s for sure
these are all clickbait shit
all clickbait
this one works, the one I sent before does not.. 😄
I can't see any differences, but I assume it has something to do with passing in the MYsql database as a parameter, but my phones about to die so I can't do much rn
never watch these types of vidoes
But like, say you've done some other languages like C, java will be so much easier.
I'm doing something wrong
well that is unfortunate
no thats fine
the reason why intellij does that is cause it warns you
if you dont call it
wait... did they use NMS?
it thinks its unused
ah no
but for eventhandlers, you dont call it. the event bus does it for you
so thats fine
nonono... 😄 code itself is okay.. just. the problem is with events. It does not execute anythig for Harvest event, because it doesnt even register it
but when i join the server there is no "welcome to the server"
It's just that IJ can't actually tell that method is ever being called, but as long as you register the listener it's fine.
I dont need how to fix that
that means u did something wrong
{
MySQL databaze = new MySQL();
public EventManager()
{
databaze.mysqlSetup();
}
@EventHandler
public void onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
{
new onPlayerHarvest(e, this.databaze);
System.out.println("Harvest!");
}
@EventHandler
public void onBlockDropItem(BlockDropItemEvent e)
{
new onBlockDropItem(e, databaze);
}
}```
This is the event manager. It doesnt even execute the "Harvest!" ... cuz its not listnening. it just throws error on server startup for the first event
new onPlayerHarvest(e, this.databaze);
??
new onBlockDropItem(e, databaze);
??
why?
that just refers to class made specificaly for the event. cuz I wanted to have "Clear eventManager" when I add more events
so every event has its own class
What are you doing in that class?
No...
why?
Just paste the code you use from that class in the event
and also the naming, please don't use that name
use a better class name
databaze -> database
Mhm
mysqlSetup -> setupMySql/setupMysql
yeah, i can do that. I already tried... but it does the same thing... 😄 the harvest event 😅
And also, why are you declaring a new instance everytime the event is called
create a manager
onPlayerHarvest -> PlayerHarvestManager
then create a method in there
which accepts the event ig
if you really want that
after all, you are just declaring new but never actually storing it as a variable and doing anything with it
just create a manager
Look, Im not a professional developer, im just a guy that is trying to create some plugin... 😄 I just asked if anyone knows why cant i listen for PlayerHarvestBlockEvent. thats all... 😅 I will look into proper class naming etc, thanks for the advice, but that does not solve my main issue...
no it doesn't, but do you not want to improve?
well I have that piece of code inside my main class and imported everything properly so i dont know what im doing wrong