#help-development
1 messages ยท Page 1600 of 1
I get com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT kitCooldown PRIMARY KEY ('631b2936-7672-474d-9b4f-3366504065f0', 'pvp' at line 1
The version of mysql is 8
yeah that's what you told me to do
CONSTRAINT kitCooldown PRIMARY KEY (UUID, Cooldown)
in teh table creation
cooldown and UUID are you column names
yea I know
that is just to set a Primary key pair on teh table
you don;t use it anywhere else in any other query
you access the table exactly as you would normally
hey i can use ChatColor.of(hex code (string?)); to get a HEX in text.. yes?
or nah
but If I can't check their UUID how else would I check
select * from ? where uuid = ? and cooldown = ?
BUT YOU JUST TOLD ME NOT TO USE UUID ANYWHERE ELSE
you don;t use CONSTRAINT anywhere else
oh
so do I not use it setting their time and getting their time?
only use it on one?
you ONLY use CONSTRAINT on table creation
I don't have a table creation though
write a query to do it
But isn't that just less efficient?
wait
can't I just run that in the query of the table on phpmyadmin?
but why lmfao
or does it have to run constantly?
why would you do it manually every time you want to delete a table
CREATE TABLE Cooldowns(
UUID varchar(50) NOT NULL,
Cooldown varchar(255) NOT NULL,
Time BIGINT UNSIGNED,
CONSTRAINT PK_KitCooldown PRIMARY KEY (UUID, Cooldown)
);```
because it's easier?
logging into phpmyadmin and pressing delete is easier then one line of code?
yea
...
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
is there any expression like that?:
event.getMessage().getFirstCharacter()...
get the damager and would probably be getCustomName https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Nameable.html#getCustomName()
not 100% sure but try it and see ig
might have to cast damager to player and use getDisplayName
declaration: package: org.bukkit, interface: Nameable
im getting this weird error https://paste.md-5.net/lisulemato.md, it has an issue with player.getTargetBlock
I got locked out of phpmyadmin
nvm i see what i did wrong, the limit for targetBlock was null
did you not give your account rights to create tables?
just nuke the db in code then lol
someone knows if there is some expression who can get the first character of player's message?
i was trying this:
event.getMessage().getFirstCharacter()
getMessage() is just a String
https://ibb.co/QjjymZJ < The imagine
Why im getting (imports) ImportOrder error while trying to compile BungeeCord( Added custom patches)
Too many connections
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1)); doesn't seem to apply any blindness for some reason
show all code
package blue.polar.rtp.events;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class PlayerRespawn implements Listener {
Random random = new Random();
List<Material> unsafe = Arrays.asList(Material.CACTUS, Material.LAVA, Material.LAVA_CAULDRON, Material.WATER);
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
if (!event.isBedSpawn()) {
boolean isSafe = false; int attempts = 0; while (!isSafe) {
attempts++;
int x = this.random.nextInt(20_000) - 10_001; int z = this.random.nextInt(20_000) - 10_101;
Block block = event.getPlayer().getWorld().getHighestBlockAt(x, z);
if (this.unsafe.contains(block.getBlockData().getMaterial())) continue;
event.setRespawnLocation(new Location(event.getPlayer().getWorld(), x, block.getY() + 4, z));
System.out.printf("[RTP] %s has respawned and been randomly teleported to %s, %s, %s after %s attempts!%n", event.getPlayer().getName(), x, block.getY() + 4, z, attempts);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 10, 1));
event.getPlayer().sendTitle(ChatColor.translateAlternateColorCodes('&', "&6&lWelcome... Home?"), "You've been teleported to a random place!", 10, 70, 20);
isSafe = true;
}
}
}
player is still dead in that code. Potion will not apply
wait 1 tick
1 tick after setRespawn?
and in teh delayed code, get a new Player object from the UUID
How would I wait 1 tick
runTask
Bukkit.getScheduler().runTask()
?scheduling
With my code how would I get the plugin it's using?
Put everything in that runTask
So all of your code is delayed by 1 Tick
Or after ur first if() statement
Would prob. be the easiest way
only the code after setRespawnLocation
^ or that would also work
your plugin instance you pass it to the class via dependency injection
Yeah so
scheduler.runTaskLater(plugin, () -> {
...
}, 1);
scheduler.runTaskLater(Bukkit.getPluginManager().getPlugin("RTP"), () -> {
...
}, 1);
so this should work?
yes
Use an instance of your plugin if you have it
I don't think I do?
This is all the code so u tell me lmfao
you could
It would be however you instance your main class
package blue.polar.rtp;
import blue.polar.rtp.events.PlayerJoin;
import blue.polar.rtp.events.PlayerRespawn;
import org.bukkit.plugin.java.JavaPlugin;
public final class RTP extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("[RTP] RTP has been enabled!");
getServer().getPluginManager().registerEvents(new PlayerRespawn(), this);
getServer().getPluginManager().registerEvents(new PlayerJoin(), this);
}
@Override
public void onDisable() {
System.out.println("[RTP] RTP has been disabled!");
}
}
this is the main class
when you register your Listener you do new listener() just use new listener(this)
so new PlayerJoin(this)
yes, then in your PlayerJoin class you add the reference in its constructor
store to a Field
plugin
alright tysm
your IDE will show you an error and one of the options will be to add a constructor
public PlayerRespawn(RTP rtp) {}
it created this
do i just leave it like that or change it to
private final RTP plugin;
public PlayerRespawn(RTP rtp) {
this.plugin = rtp;
}
now in teh constructor add this.plugin = rtp
yep
make teh Field final
oh you have
yeah ide did it for me
Hey I have a quick question!
I am currently trying to get MySQL running again, but I'm running into a problem since I never worked with INSERT INTO ON DUPLICATE KEY.
Here's my SQL:
"ON DUPLICATE KEY UPDATE %selection% = %var%```
My table looks like this:
``user | vote1 | vote2 | vote3 | vote4 | vote5 | vote6 | vote7 | vote8 | vote9 | vote10``
(The values vote1-10 are replaced by actual names, just to simplify I wrote it as vote)
I am replacing %table% with the Table,
%selection% with the selected *vote1-10* column,
%player% with the Player's Name
and %var% with a Number from 1 - 5
I am currently getting this Error though: ``java.sql.SQLSyntaxErrorException: Unknown column 'StunterLetsPlay' in 'field list'``
Try adding a space before your ON DUPLICATE
Or after the closing bracket at the line above. Same outcome.
Nope, sadly didn't work, same error after all
I should add that it worked when the SQL looked like this:
"ON DUPLICATE KEY UPDATE %selection% = %var%```
But this then set's the User as [NULL] and keeps adding new Rows
It's returning null for no reason. And it started doing this after i checked if the user had a permission,
So i was wondering what the cause is??? Cause if they run the cmd for example: /refresh test than it would work but yet just /refresh in general doesn't work and returns null it doesn't make much sense, and i have return true; after the msg, so im starting to think that i just need to put return;
It's not returning null firstly, its a index out of bounds
You are trying to get the first element from an array with 0 elements in it
okay I figured it out, I typed StunterLetsPlay instead of "StunterLetsPlay" in the Values.
It is putting in the Lines now, but it's not replacing the currently existing ones.
Well im trying to do like a "help" cmd, type thing, soo, im wondering if its spacing issues or not
Also i dont have an array list setup.
If you just type in a command without any additional arguments then the array will be empty.
Ok
But i want it to return a msg, and not an error,
Cuz i never had this issue before where running a cmd with a perm check leads to this
Show your code pls
Yep
if(cmd.getName().equalsIgnoreCase("refresh")) {
if(p.hasPermission("plugmode.refresh")) {
if(args.length == 0) {
p.sendMessage(prefix + ChatColor.RED + "Please select a plugin from the list:");
p.performCommand("pl");
return true;
}
if(args[0].equalsIgnoreCase("PlugMode")) {
p.sendMessage(prefix + ChatColor.RED + "You can not reload the plugin" + ChatColor.YELLOW + " PlugMode");
return true;
}else if(args[0].equalsIgnoreCase(args[0])) {
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) == null) {
p.sendMessage(prefix + ChatColor.RED + "This plugin isn't loaded on the server.");
return true;
}
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) != null) {
p.sendMessage(prefix + ChatColor.GREEN + "Reloaded the plugin: " + ChatColor.YELLOW + args[0]);
getServer().getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
getServer().getPluginManager().enablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
return true;
}
}
}
if(!p.hasPermission("plugmode.refresh")) {
p.sendMessage(prefix + ChatColor.RED + "You do not have the permission to run this command.");
return true;
}
}
Everything else works fine dont get me wrong
But its just the when u run the cmd it just doesnt return a msg
if(cmd.getName().equalsIgnoreCase("refresh"))This check is useless in 99% of cases
How
- i have other cmds in that as well
Bc i have more than 1 cmd with in the command check thing
Ah i see. So you use one CommandExecutor for several commands
Yes pretty much
But that doesnt matter, anyway how can i fix that array null issue
if(cmd.getName().equalsIgnoreCase("refresh")) {
if(p.hasPermission("plugmode.refresh")) {
if(args.length == 0) {
p.sendMessage(prefix + ChatColor.RED + "Please select a plugin from the list:");
p.performCommand("pl");
return true;
}
Cuz its just that issue,
That doesnt return anything
Show the full stack trace pls
^
What's line 37
I showed u the entire error.
Oh wait. You use your main class as CommandExecutor?
This
Then the "args" array does not contain any elements at that point
But you are using 1.8 anyways so im out
You must be doing that before the args.length == 0 return
Im not
Lmfao
Im using 1.17.1
if (args[0].equalsIgnoreCase("pluginfo")) {
if(p.hasPermission("plugmode.info")) {
if(args.length == 0) {
p.sendMessage(ChatColor.GOLD + "" + ChatColor.STRIKETHROUGH + "---------------------------------");
p.sendMessage(ChatColor.BLUE + "");
p.sendMessage(ChatColor.GRAY + "Author: " + ChatColor.YELLOW + "Dishy");
p.sendMessage(ChatColor.GRAY + "");
p.sendMessage(ChatColor.GRAY + "Version: " + ChatColor.GOLD + "1.0");
p.sendMessage(ChatColor.GRAY + "");
p.sendMessage(ChatColor.GRAY + "Support Discord: " + ChatColor.LIGHT_PURPLE + "https://");
p.sendMessage(ChatColor.BLUE + "");
p.sendMessage(ChatColor.GOLD + "" + ChatColor.STRIKETHROUGH + "---------------------------------");
return true;
}
}
if(!p.hasPermission("plugmode.info")) {
p.sendMessage(prefix + ChatColor.RED + "You do not have the permission to run this command.");
return true;
}
}
Shiz self ad my bad
Yeah you are, check args.length first
Your stack trace tells me something else
Buddy im running a 1.8 server
Just bc im running a 1.8 server doesnt mean the plugin cant be 1.17
Doesn't really matter
And thats why i decided im not supporting you
Okay so check before hand???
Yes
Lmfao okay whatever dude\
you should really update
Okay for instance:
if(args.length == 0){
cmd stuff here
}
1.8 is very old
Dude my PLUGIN is 1.17.1
!= 0
It doesnt matter if im on 1.8 as a client side
see above
If it's 0 you should tell them to put something
yes but 1.8 is still very old
Yes thats what im trying to do
The version doesn't even matter here so why are we talking about it
Everything else works fine except for the code at == 0
Yeah because you're checking for an argument when there are none
That's why it's erroring
So check if there's args, then check them
Ok so if the argument = something than under that i put != 0?
Your server version is really old and contains a ton of bugs that will never be resolved. Support for that version was dropped years ago. Using it is just shooting yourself in the leg.
Dude idc lmfao i dont need server support regarding a jar file., i could care less about versions
Idk why versions matters to you so much anyway
Because the small community still clinging to old versions hurt the progress of the api for several years now.
Bro im not even using an api lmfao
lol...
What is Spigot to you then?
if (args[0].equalsIgnoreCase("pluginfo")) {
if(p.hasPermission("plugmode.info")) {
if(args.length == 0) {
p.sendMessage(ChatColor.GOLD + "" + ChatColor.STRIKETHROUGH + "---------------------------------");
p.sendMessage(ChatColor.BLUE + "");
p.sendMessage(ChatColor.GRAY + "Author: " + ChatColor.YELLOW + "Dishy");
p.sendMessage(ChatColor.GRAY + "");
p.sendMessage(ChatColor.GRAY + "Version: " + ChatColor.GOLD + "1.0");
p.sendMessage(ChatColor.GRAY + "");
p.sendMessage(ChatColor.GRAY + "Support Discord: " + ChatColor.LIGHT_PURPLE + "https://discord.gg/spigotmc");
p.sendMessage(ChatColor.BLUE + "");
p.sendMessage(ChatColor.GOLD + "" + ChatColor.STRIKETHROUGH + "---------------------------------");
return true;
}
}
if(!p.hasPermission("plugmode.info")) {
p.sendMessage(prefix + ChatColor.RED + "You do not have the permission to run this command.");
return true;
}
}
Im basically trying to make a "help" menu here.
A jar for starting up servers.
//Make sure the user put an argument, if they didn't, return.
if(args.length == 0) {
return true;
}
//Now we can check if the first argument is this, since we know it exists.
if(args[0].equalsIgnoreCase("pluginfo") {
//stuff
}
love how that made the invite
- im using 1.17.1 for my plugin lol
Ikr xd
Erm ok
Wait I see what you're doing
Ok
if(args.length == 1 && args[0].equalsIgnoreCase("pluginfo") {
//execute pluginfo here
}
My plugin is fr on the latest version and my server is on 1.8 idk why this is uch a big deal over a SERVER version. When a PLUGIN is on 1.17.1. Do you not see how stupid you sound rn?
Alright ill give this a try.
#help-server maybe then?
Then running a server on 1.8 makes no sense. Also Spigot is not a "jar to start up the server". Its primarily an API.
Then get rid of the args.length == 0 inside
Omg I DONT NEED HELP WITH A SERVER!
dude calm down
Yk what everyone just stfu except for dessie and rack
You're the one that wants support for unsupported software
Im telling u 80% of this community is all brains, and the rest is all idiots.
Should they be using 1.17? Yes. Does it matter with what they need? Nope. Don't even know why we're talking about versions.
Buddy i have a plugin on 1.17.1 and im running a 1.8 server why does this matter
Why does a server version matter when hit has nothing to do with a plugin version
I dont think i am sounding stupid by telling you that developing for a new version and then using half a decade old software instead makes no sense and is literally asking for problems...
Bugs.
Yeah i dont either
Why are we fighting over Minecraft Versions
I dunno.
Server version matters because the api has changed over multiple versions
I missed most of it.
Yee
Is that fr what you guys care about??? A server fversion thats my preferance???? If so PLEASE just leave teh chat rn, and go help someone in #help-server please.
Dude its a personal preferance xD it doesn't matter what you use, as long as you know wtf ur doing
Does spigot 1.17.1 support 1.8 servers?
Yes
Spigot officially only supports latest
This discord, it's up to the users which they support
Really? Cause last time i checked im making a 1.17.1 plugin and it works on 1.8
Honestly tho
A personal preferance to shoot yourself in the knee. Also developing a plugin for 1.17.1 and then deploying it on a 1.8 Server wont work for many reasons.
There's a lot of stuff that's changed backend
It'll work as long as the methods, fields and classes you use are also in the 1.8 JAR
Just because something is backwards compatible doesn't mean its supported.
It might work cuz it prob. has the same loading structure, doesn't say it will work for everything though
It might work, it might not
I mean its clearly working for me, sooo idk what ur getting at
With what they needed, it works. So version is completely redundant.
^
Just recommend they update and move on ๐
By what i have read from you so far i wouldnt be surprised if you developed against 1.7.1 Beta instead XD
Generally you develop an application for the platform you deploy to
That's all
Yeah its a recommendation, not a "Oh hey ur runnining 1.8? Ok we are gonna delete system 32."
Your life will be easier you you build against 1.8 JAR btw Dishy
Yes ik, and i have a server on 1.17.1 that im not using atm bc im making things for it
Last time i did that i got yelled at for no reason.
Can build against both
Honestly though, these kids gotta chillaxe over a dang server version lmao
Well if it's a 1.8 plugin you should be building against the 1.8 API
Even with it not being supported officially
Yup
Its a 1.17.1 plugin...
Let me rephrase
They're just giving suggestions & trying to help. They are right tbh ยฏ_(ใ)_/ยฏ
If you are going to be running it only on 1.8 you should build against the 1.8 jar
^
Im not gonna be running it only on 1.8
As a lot of methods have changed in 9 major versions
Thats why there is a 1.17.1 jar file in it
If you just call one method in 1.17 that doesnt exist in 1.8 your plugin will just crash... Makes literally no sense to build a 1.17 plugin then run it on a 1.8 server.
Run on 1.8, build on 1.8
Run on 1.17, build on 1.17
make two versions of the plugin
Run on both, build on both
Literally everything im using in my plugin is all 1.8 supported.
If that's what works for you, go for it. It only really makes a difference for the developer.
Look at this Uranium. Im holding it and im still living. So it must be safe.
Yeesh, guys.
Dude it doesnt matter over a server version
Just like move on from the topic
Idk why this is such a big deal
Have you been able to verify what I said is what you needed dishy?
What was the original problem?
Uh im currently working on adding it to all the cmds atm
๐
We explained to you several times. Anyways... Is your problem resolved?
I think I solved it, just waiting for them to test.
I think dessie might of helped me idk yet, just figuring it out
Yeah ik, and i listened to it, im just not understanding why my choices matters to u guys
Like, thats all
Your choices are questionable and may lead to issues
As for your code, I'm still parsing it
I think dessie's fix works, but it's mildly spaghetti
Send the new code
Its really not that complicated...
Just accessing an array without checking if it has elements in it beforehand.
Pls paste the whole command method.
if(args.length == 0 && args[0].equalsIgnoreCase("refresh")) {
Player p = (Player)sender;
String prefix = ChatColor.GRAY + "[" + ChatColor.AQUA + "PM" + ChatColor.GRAY + "] ";
if(p.hasPermission("plugmode.refresh") && sender instanceof Player) {
if(args.length == 0) {
p.sendMessage(prefix + ChatColor.RED + "Please select a plugin from the list:");
p.performCommand("pl");
return true;
}
if(args[0].equalsIgnoreCase("PlugMode")) {
p.sendMessage(prefix + ChatColor.RED + "You can not reload the plugin" + ChatColor.YELLOW + " PlugMode");
return true;
}else if(args[0].equalsIgnoreCase(args[0])) {
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) == null) {
p.sendMessage(prefix + ChatColor.RED + "This plugin isn't loaded on the server.");
return true;
}
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) != null) {
p.sendMessage(prefix + ChatColor.GREEN + "Reloaded the plugin: " + ChatColor.YELLOW + args[0]);
getServer().getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
getServer().getPluginManager().enablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
return true;
}
}
}
if(!p.hasPermission("plugmode.refresh")) {
p.sendMessage(prefix + ChatColor.RED + "You do not have the permission to run this command.");
return true;
}
}
-> args.length == 0 && args[0].equalsIgnoreCase("refresh") This will always throw an exception
I event put == 1 and it didnt work
I'd wrap the whole thing in a length checker
args.length == 0 -> args.length != 0 is more resilient than args.length == 1
if(args.length == 1 && args[0].equalsIgnoreCase("refresh")) {
Player p = (Player)sender;
String prefix = ChatColor.GRAY + "[" + ChatColor.AQUA + "PM" + ChatColor.GRAY + "] ";
if(p.hasPermission("plugmode.refresh") && sender instanceof Player) {
if(args.length == 0) {
p.sendMessage(prefix + ChatColor.RED + "Please select a plugin from the list:");
p.performCommand("pl");
return true;
}
if(args[0].equalsIgnoreCase("PlugMode")) {
p.sendMessage(prefix + ChatColor.RED + "You can not reload the plugin" + ChatColor.YELLOW + " PlugMode");
return true;
}else if(args[0].equalsIgnoreCase(args[0])) {
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) == null) {
p.sendMessage(prefix + ChatColor.RED + "This plugin isn't loaded on the server.");
return true;
}
if (Bukkit.getServer().getPluginManager().getPlugin(args[0]) != null) {
p.sendMessage(prefix + ChatColor.GREEN + "Reloaded the plugin: " + ChatColor.YELLOW + args[0]);
getServer().getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
getServer().getPluginManager().enablePlugin(Bukkit.getPluginManager().getPlugin(args[0]));
return true;
}
}
}
if(!p.hasPermission("plugmode.refresh")) {
p.sendMessage(prefix + ChatColor.RED + "You do not have the permission to run this command.");
return true;
}
}
Still raises the exception on that first line?
In their original args thing they were specifically looking for "pluginfo" being the ONLY argument, thats why I did args.length == 1
What error does this throw? Shouldn't be the same.
that code will not throw that error
it does
It's not possible
Not possible.
Is this line 37? if(args.length == 1 && args[0].equalsIgnoreCase("refresh")) {
Whats 37
wups i mean 113
bruh
37 is plugininfo
Then pls show us the code that actually throws the exception...
Wait, why are you showing us this code if it's not what's broken
No i used the code u sent me dessie
Send that then
you know
u guys dont listen
do u
i just said
my wifi is out on my pc
like i JUST said that
soon as u pinged me
That makes no difference really
Take a picture if you really need to
The codes on the server so you could still check the error, just won't be able to hot patch
if(args.length == 00 && args[0].equalsIgnoreCase("pluginfo")){
if(p.hasPermission("plugmode.info")){
p.sendMess("msg u get the point x this by 8"); <- duck this im not typing out all the msgs over and over.
return true;
}
if(!p.hasPermission("plugmode.info")){
p.sendMessage(prefix + ChatColor.RED + "You dont have the perms to d othis yaayyaytayay ata");
return true;
}
}
You don't listen do you
๐
This again, always throws an exception if(args.length == 00 && args[0].equalsIgnoreCase("pluginfo"))
this is how i feel rn having to retype the code..
Do you understand how java arrays work?
Stopp. His wifi was down. How should he know about arrays?
I think that was more of an insult but idk
Okay
bro i know java,
thats the thing
i fr initially came in here to get to know what the error was about and how i could solve it
bc i never encoutered the error before
if(args.length == 00 && args[0].equalsIgnoreCase("pluginfo"))
What do you think caused it
dude even before that
It gives you the line, it tells you what happened
As stated before:
Do not access the content of an array unless you checked if its length supports the index you are accessing.
It's the same error all the way back
when i had args[0].equalsIgnoreCase("pluginfo"){
if(args.length == 0){
}
}
length must be 1 for you to have an args[0]
yeah ik and i did that
why is it every plugin i code related to cmds and do args[0] and etc and everything wroks out no errors
and this one has to be problematic
for no reason
Array index out of bounds on line ## means you tried to access an array index that was out of bounds on line ##
Your statement currently reads as follows:
If the array is empty, give me its first element.
If I have zero apples, give me an apple
That one causes the issue because it's the first one that has a chance to throw the error
The next part does
Yeah ik
Yes but the second condition
you said first which threw me off
First of the several if statements
Gotcha, just wanted to clarify.
He is referring to the method exiting as soon as an exception is thrown
yk what i just said fuck it and removed the entire cmd itself
the cmd itself can live without being in the plugin
and guess what
soon as i removed that
everything started to work again
@manic crater best way to handle this would probably be to just check that the arg array is at least one before continuing, else print an error and return
ughh
gonna be real with u, i just removed it and it all started to work again
Now you are just trolling us, right?
no im not
See previous statement about learning java
Go learn java
Well yeah if you remove the errored code it does tend to start working again...
yes ik that
im not stupid
You don't even understand arrays though
i understand arrays just not a bunch
That's like week four basic java
Wait. You removed the code that threw an exception and now your application works? That was unexpected. Maybe i should try that too.
im not TechsCode where i use arrays in 90% of my plugins
ur insults/sarcasm is trash.
gonna be real with u on that
If you knew java, you should know arrays
Well, good luck making future commands with arguments without arrays.. ๐
Maybe don't compare yourself to TechsCode with what happened
dude i know how to make cmds, with arguments
im not comparing myself
Why should we help someone without a basic understanding of the language?
Thank you but your opinion on that has no value to me ^^
im stating a fact that techscode knows more about arrays
same with ur insults.
value = 0
There's not much about arrays to know
so does the whole point in this toxicity bit of the gc
Thank you ๐
ik
So learn it
๐
arrays store data and value in them if u know how to do so
technically not anymore
Stop debugging by superstition and actually git gud
how, is it bc hes dead and his friends are taking over the plugin coding? or u just saying that bc u feel like it
yeah techscode died in a car accident...
so his friends are taking over the coding...
Damnn\
what happened
What did i just witness?
idk
idk
dude doesn't know how to use arrays -> instead of listening deletes entire section of code -> problem solved
shut up u lmfao ๐
Maybe don't tell them to shut up and actually read it
i do know how to, i dealt with arrays before.
dude i dealt with arrays before...
i just didnt understand the error,
I felt like he was a bit rude. But then again... he is a 1.8.8 user after all.
New mantra, if deleting doesn't make it work give up?
Obviously you don't
omg...
Don't know why you need to ping me two fucking times with the same reason and you clearly haven't enough
im gonna punch u one day in the fact @lost matrix honestly,
server versions for testing things doesnt matter
smh
punch him in the facts, those hurt
we dont support 1.8 here ๐
hey imagine wanna add a 5s slowdown
Ok thats just a straight up threat now.
k well like i said, i have a 1.8 test server and a 1.17.1 plugin there is a difference
Running a 1.17.1 plugin on 1.8, checked that an array was zero length before grabbing an index from it
that isnt a threat, its a insult,
๐
just bc i wanna punch u in the face doesnt mean its a threat softy
The difference is it's even worse support wise
yeah ik, but it doesnt matter
well you told him you were going to which makes it a threat rather then wanted
its a TEST server for a reason not a REAL server
We don't support 1.8 and we don't support stupid
That should be pinned BobLaser

yeah so? just bc i told him i was gonna punch him in the face doesnt mean im actually gonna do it lmfao i dont even know where he lives for starters, and idc for where he lives
Here's a little bit of info that might blow your mind
Test on the same platform you deploy to
Dude imma start kicking some people if you don't knock it off
Sure. At this point im just sad for you... 
You deploy to 1.17? Make a 1.17 server
choco they are saying the support for me is unwanted bc i have a 1.8 test server and i found it easier to make a plugin on 1.17.1 and not change the server version as it was gonna take 2 seconds to do
can yall just stop and move on?
Nough said
We have not supported 1.8 in this server since the release of 1.9
If you want to work on 1.8, do it yourself. Do not expect support here, you are not entitled to it
okay but once again a 1.17.1 plugin clearly works on 1.8 if u dont use 1.17 methods
That's great. Keep doing that
yeah
thats what im TRYING to do
and we are having an argument
over a version i couldnt swap out in time even if i tried
So don't have an argument. I don't get it.
yeah but the thing is i didnt even start it @lost matrix was crying over a version i didnt wanna swap for a cmd,
thats the thing
For next time, it's best to have a testing environment that matches your production environment as close as possible. That's just standard practice
I just stated that developing a plugin for 1.17.1 and then deploying it on a 1.8 server is really prone to errors. It just hinders everyone involved in fixing bugs that emerge from this composition. Including us.
then switch
3 cmds that had nothing to do with 1.17 features
literally
i dont know why this is such a big deal
over a version that is gonna do nothing to a 1.17.1 plugin
You can spin up a server in a few seconds
bruh wheres your original question
It's been solved
yes ik and i didnt wanna do that bc i had other thigns to do
then move tf on its not hurting nobody
just drop the argument fr, its a pointless argument and u are gonna just get us all kicked.
Array index out of bounds
Yikes
i mean clearly its hurting that 7 whatever kid
this was my original question
but my situation is fixed
so don't bother
C'mon dishy, think about it. You wouldn't write a program for windows 10 and test it on vista, would you? You at least understand why people are saying it's a bad idea?
@whole stag move on
yes ik why its a bad idea.
ik that i understand that
Cool
Is good then
idk how that effects 1.8 in anyway or 1.17.1
both of you move on, last warning
can y'all not just drop the topic and move on jesus christ
y'all are worse than League of Legends Players
anyway drop the convo bc imaginedev is gonna kick us
As long as you understand the practices you break, there's no big issue. All good ๐
hush ur gonna start up another argument, for no reaosn
im not gonna get kicked bc of u
That was quite amusing
ok yeah I just did it through phpmyadmin
are you sure its correct?
is there a way to modify the damage with armor point? or the formula is the only way?
yeah look https://imgur.com/AOwxgw6
as damage modifier is deprecated
Attributes
it's still the same ElgarL
how many in your RS?
i got the armor points but idk if theres a method like setDamage(DamageModifier, Value)
0
1
0
thats why idk is the formula the only way to do so
1 is correct, thats what the constraint primary key pair does
it should be impossible to have more than one entry now
what value is your getTime now returning?
1627356326236
is that for someone without a timer?
yea
Looks like unix epoch time. I guess that's what it defaults to?
What does it look like for someone with a timer?
your getTime method is bad. it should be returning zero
same thing
?paste your entire getTime method
the other kits are apperently on cooldown but they were never called or in the database
um, is time a Field?
no
where is it defined then?
above the method it's a long
then its a field
lmao
wait a long counts as a field?
it needs to be a local variable, or it will retain whatever was read last
Fields and variables are the same thing
a Field is a Class scope variable
You thinking this is it Elgar?
return time = 0;
Ah, gotcha. kinda the same thing then. :)
he needs to scrap all that time variable
just return zero in any instance there is no rs.next()
the only result you care about is the time
if there is a next() then you got a result which means there must have been a UUID and Cooldown match
if no rs then returns zero
oh I see
I thought if res.next passed through it was empty
yes, which means no timer so return zero
I wish it was a bit faster to connect and load the data but it's fine
Thank you very much
I was just playing ๐
gradle why
lmao
code golf time? ๐คฃ
as this is a command cooldown and an sql query you shoudl nto run it on the main thread
Is it faster if It's not
it won't be faster but you won;t lock up the server (lag) while its running the query
get it working first though
You also know these kind of timers can be stored in the PDC where queries would be instant?
Yeah I got it working
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url = "http://repo.onarandombox.com/content/groups/public/" }
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.12'
compileOnly 'com.onarandombox.multiverseinventories:Multiverse-Inventories:4.2.2'
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.2.2'
}
dont think its related to the build.gradle
it just crashed
when i tried to add a new fie :/
pdc?
weirdd
?pdc
its data stored on teh Player object
1.8 man
pleb ๐
smh
you look like nms
does TagAPI work on 1.8?
uh
that selfie got more dust on the camera then a desert documentary
maybe Elgar
that pfp so bright it lit up my dark room
that dot on your chin was mistaken for a bug on it
sorry I was thinking NBT-API. does the same thing as PDC https://www.spigotmc.org/resources/nbt-api.7939/
wooooww
crusty ass face structure
im sorry
plz accept apology
@proud basin i havent roasted in 2 years because quartinine
I want a direct message from you on spigot page
about what :P
not my account
what is it
for some reason my friend tried linking his account to mine ๐คท
but search me up on spigot
my account
then yes it does
Is there a reason why nbt-api would make it faster
Is that how like essentialsX and all the other ones do it?
it was a good learning process
True
Why do you have ```java
public ItemBuilder() {
this.setType(Material.BARRIER);
}
Was testing. Trying to see if it just wasn't setting the material
hm ok
you should name the clone method "build"
clone() is an ItemStack method
He could also name it "make"
...so if i want an event to run before all other event
do i use lowest or highest
Lowest.
Highest is if you want to change it after everything else runs it
confusing description
oh
okay
if i set damage to 5 in a lowest event and then some other event with the priority of high sets the damage to 10
will the dmg be 5 or 10
10
so to change the final value of stuff
i need the highest priority
correct
rip
bump
Hello guys! How are you? I really need your help. So my friend created a server in minecraft with mods and everything was ok. But when i want to connect to server there is error that comes in. Please help me with this problem. Thank you so much, i really appreciate you!!!
i can't send the picture
Gotta be verified.
how to?
The verification channel. I can't mention it cause I'm verified.
!verify
Usage: !verify <forums username>
!verify MeFoZ_313
Could not find your SpigotMC.org account!
#verified
Thats when you are verified. Not the bot channel
!verify gooGooGaaGaa
Could not find your SpigotMC.org account!
bot channel? what?
oh he cant see the verified channel?
ye
RIP
When you aren't verified there use to be a verification channel. IDK if it was removed because once you're verified you lost access to it
contact staff probably dunno
uhh no?
its just
ppl started talking in the verified channel
like i see
a while ago ppl only do the !verify in there
I'm not talking about the newly created "VERIFIED" channel. I'm talking about the verification channel you used to verify.
Again it might have been removed.
The command works fine in here, but you have to use your ACTUAL spigotMC.org account name
๐ญ
gradle go brrrr
help pls i have no fuckin idea whats happening
like i added plugin.yml
and then the IDE lagged
and then bukkit got un-imported or something
thats probably a messed up cache
i invalidated cahce and restrated :<
Then no clue, I don;t use gradle
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url = "http://repo.onarandombox.com/content/groups/public/" }
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.12'
compileOnly 'com.onarandombox.multiverseinventories:Multiverse-Inventories:4.2.2'
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.2.2'
}```
build.gradle btw
is gradle so unpopular
how many ppl use maven vs gradle
gradle is just more powerful than most need
isn't 1.16.5 supposed to be R3?
don;t need the features or complexity
r3? where?
you have it as 1.16.5-R0
oh
where can you like
see which R is it
is there like a convenient website somehwere
the version...
just look in teh maven repo
gradle is related to maven somehow?
yes, it uses maven depends and repos
oh okay
Huh... looks like it is R0 Why would /version be R3?
im waiting for your aid. Thank you so much again( if you can't resolve it, it's okey!!!!)
๐ฅบ ๐
You said mods... Do you have all the mods installed?
Update your server software ๐คท
Why are you using clone()
Tested with and without
You should have a build() method that returns the ItemStack with all the properties.
And I wouldn't even bother extending ItemStack really
Just use the build method to get an actual ItemStack
Yeah did that so I wouldn't have to create an itemstack every time.
You're technically making one anyways
yeah but I'm able to edit it as a class. Not itemstack.<method> for everything
In your constructor, try calling super()
I'm guessing it does some backend stuff that you're not
possibly. Ill try
Didn't work either.
Send the new code
I updated the pastebin
Nope doesn't work either
๐ค
Well I took off clone on the first one and all the items showed up.... But the second one (after I set everything) still has .clone()
first and second what
Yeah get rid of the clone
Clone on the second one works. But the first one doesn't lol
I just tested and this works:
public class TestItem extends ItemStack {
public TestItem(Material material) {
super(material);
}
}
//Then to give to the player
player.getInventory().addItem(new TestItem(Material.BARRIER));
Yeah its odd.
Well its works now so ๐คท Thanks for the help
Yes. I was testing it and the invalid item isn't always commented out
so was making sure it was even created the invalid item.
Ah
SkullMeta.setOwner(String) was replaced with SkullMeta.setOwningPlayer(OfflinePlayer)
I use setOwner() for MHF skulls so what would I used for that as an offlineplayer?
Bukkit.getOfflinePlayer(String)
?
Will that work for MHF?
I know I can but would prefer not to lol
youd want to get the player by uuid
Without using deprecated methods, you cannot obtain a player with name unless the player is online
When you want to set a skull by player name??
If the player is online you can getPlayer by name
Of course
not entirely true, alternatively you can use getOfflinePlayerIfCached which will take a string
nevermind, paper-specific
Bruhh
Paper..
Yeah, but then he'll have to wait until the official MHF accounts join his server lmao
What are we talking about? This isn't a solution
edited with spigot link
now my eyes are playing tricks with me yeah thats different nevermind
Just use #setOwner
But you can getOfflinePlayers and filter with name lolol
Only if they have joined your server previously
Yea and that
hold on, from the appearance of this method and the fact its returning a Player object which the description says it doesnt have to be connected, it might be grabbing a player from mojang's api?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getPlayerExact(java.lang.String)
let me look into the code
but if that is the case it can be used whether or not theyve been online
The description didnt say so
the description of the player class
damn took a look into the code and it just routes back to the server
another dead end
But it makes sense to say he/she might not be connected
A reference to the player object might still exists
After he/she disconnects
Hence PlayerQuitEvent or PlayerKickEvent
this appears as if theyre trying to grab players that have been online long ago, though
the only solution i could think of is directly accessing mojang's api to get the uuid then using that in Bukkit#getOfflinePlayer(UUID uuid)
Just pointing out MHF are mojang usernames and will never join the server. (Unless someone some how got ahold of one.)
I think your best bet is using deprecated methods, it is fair to do so since spigot's deprecated methods aint really gonna get removed
Hello. I was wondering how to optimize debug time.
I use the intellij live server, but the hoswap is very limited.
I saw that there is a JDK (DCEVM) that allows Hotswaps with fewer limitations, but it is for jdk7,8,11
How do you work?
my server have problem
when i login in my account
i got disconnect after login 5second
yes
setColor(String color)
And
setColor(int colorNumber)
^^^
Hello to you !
Quick question about the spigot API.
I'm creating a freeze system and so I have to cancel all the commands of a player.
Logically I have to choose the priority of the event, but I don't understand Spigot's priority system ...
The event with the highest priority will be called last if I understood correctly ... So in my case, since I want my event to cancel all other same events from plugins, I have to give it the lowest priority?
It's not very intuitive ...
you dont need to give it a priority?
guy is zombie got 2 armor pt by default?
with livingEntity.getAttribute(Armor)
but other mob are 0
why ?
wait zombie actually has 2 basic armor?
Idfk xd
Oh okay ๐ค
After all, isn't it because you don't do it that I shouldn't do it?
Maybe you never asked yourself the question, but I prefer to be sure that my event will override the others
If you donโt give it a priority it defaults to โnormalโ which is between low and high
It specifies the call is neither important nor unimportant
In my case, calls are important.
I want the calls to be made before all the other plugins in order to be able to cancel the event first
Then EventPriority.HIGHEST is what youโre looking for
Itโs going to depend on if the other plugins ignore already cancelled events or not
I just saw your original question
Oh okay thank you, I though it was EventPriority.LOWEST ๐ค
So the highest priority will be triggered first
Ah, so it doesn't depend on me
If you cancel the event first most plugins will ignore it when it is passed to them
Some, for one reason or another, will still work with it however
Yup of course!
how do i add the availability for some items on enchantment?
Test with just highest first and see how it goes, you might need to also make an event with lowest priority just to see if that fills in the gaps if highest doesnโt work on its own
eg damage_all for a diamond hoe
and u can use avril or enchant table to add the enchantment
onto the diamond hoe
This is not true, HIGHEST is one of the latest calls
LOWEST is first, ending with HIGHEST and then MONITOR
Also not true, ignoreCancelled state exists within the EventHandler annotation for this reason
Cancelling should be done on LOWEST/LOW such that you can give other plugins the ability to check for the cancelled state on NORMAL / HIGH / HIGHEST, for maximum compatibility
How can I slower natural health regen?
Cancel EntityRegainHealthEvent
I would like to program my own ore generator where you place a diamond generator for example, and a diamond comes out every 200 seconds. I am not sure because this is a kind of freebuild server and I think that with 50 players it is a bit bad for performance, My idea would be to start 5 runnables for 5 generator types and as an example the 1 is the diamond generator, then it goes through all diamond generators or does someone have a better idea?
I mean, why would you need 5 runnables?
you can just schedule one, and loop over a collection of generators to generate their next ore
wont this just disable health regen?
Yes so keep track of it yourself
Yeah, but if you want to โslowerโ regeneration, you just cancel the event sometimes
Like maybe just cancel every other event
Thats right, thank you
You could skip it alternating, so skip, allow, skip, allow on a per-player basis (keeping track of some counter in some map or sth, but thats up to you)
so how can I know when to cancel it? based of what?
^
and you ofc need to check if its a player, and determine what type of regains you want to slow down
declaration: package: org.bukkit.event.entity, class: EntityRegainHealthEvent, enum: RegainReason
this timer works every 120 seconds, so command Run is invoke every 2 minutes
maybe change 2400 to lower value for test purpose
nope
Assuming count is a class variable it wont work when youโre scheduling 2 games
you should control time by count varble
It might be better to initialise a map, from game id -> start time, and compare that to System.currentMillis
& it seems you never reset the count variable after use
@upper skiff I made class to easier manage task, you may consider use it ๐ https://github.com/jwdeveloper/Spigot_JW_API/blob/master/src/main/java/jw/task/TaskTimer.java
new TaskTimer(20, new TaskTimer.TaskAction()
{
@Override
public void execute(int time, TaskTimer taskTimer)
{
//after 120 seconds task is stoped
if(time>120)
{
taskTimer.cancel();
}
}
}).runAsync();```
Thank you very much ๐ very nice of you
You should def not start a task for decrementing a timer like that.
Use unix timestamps mapped to the cooldown context.
is there a way to get a food's nutrition value without NMS?
Hard coding it?
I dont see any way using Material or ItemMeta.
So probably just using a lut
If I want spectators in a minigame (people who died) what is the best thing to give them? I though about cancelling interact event, give them fly and make them invisible. Anything I miss here?
can't you just set them in spectrator?
Then I can't give them the compass item
Spectator mode ;D
Otherwise you will have to make sure that the user doesnt interfere with other users by catching arrows for example.
Hey, how was the concurrent queue for HashMap named?
probably for a number of different reasons, what i guess is that they want you to be able to open the menu
can't you set their hitbox to zero?
I know the game sometimes glitches out and does that
Hitbox?
yea
theres a glitch where the hitbox of a player is just gone
i dont know how that happened tho
maybe its a paper specific thing too
Btw I already cancel an event where the player gets hit, this also works for arrows
is there a way i can get https://www.minecraftskins.com/skin/15172795/jam-jar--head-/ in game without havin to download something? like is there a /give command or a mat name? ( I wanna add it to my plugin )
Spectator mode has features you have to block. Easier to just make the player hidden to others.
or that
there is a give command for heads
it grabs the current skin and throws it onto a head
ik but is there a way to get it from a link?
Yes I will make them hidden, then the chance they hit with anything is so small
And I already cancel damage events
But how can I add the invisible effect?
more like i wanna use a skin thats not on my player? is there a way i can get it from a link?
or like how can i use a head as a mat in my plugin?
thats possible you just need to define the player you want the head of
material is more difficult
yea so should i like buy more vertions of mc to do that lmao
not exactly, I have to go now but, if the skin changes, the heads that were generated should not change
try the /give command there is a way to get player heads
just change your skin around a bit
see you guys later
Can't I just do player.hidePlayer to others?
But if the hidden player stands in the way of an arrow they will still block it.
Yes true
Because the server still knows that they are there
You can try cancelling the ProjectileHitEvent or extrapolate the flight direction of projectiles then tp the player out of the way.
That seems complicated
Eh. Not too bad. Want me to write you an example?
Yes if you can do for me
Alright let me start my IDE
You have .setBounce, I will set it to false
I don't remember hidePlayer() causing that type of issue...
I just tested it and you can actually just cancel the ProjectileHitEvent
Yes
Ok thx
How can I get the head of a player to put in the spectator menu?
for(org.bukkit.entity.Player onlinePlayer : Bukkit.getOnlinePlayers())
{
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta skullMeta = (SkullMeta) playerHead.getItemMeta();
skullMeta.setOwningPlayer(onlinePlayer);
playerHead.setItemMeta(skullMeta);
inventory.addItems(playerHead);
}
Smth like this?
setOwningPlayer is deprecated so use setOwner instead
๐คฆ Other way around
Oh yeah my bad
How do i simulate a end gateway block that's spawned far out in the end? IE, throw a player in the end to the obsidian platform on the main island as if you jumped through one?
I know i can just grab the coordinates but i want it to work for every server not just my test server
That facepalm was harsh and unnecessary but thanks I guess ๐
Every world has a spawn location
So just get the spawn location from the end and tp there
The second to last convo is literally me asking about setOwner and setOwningPlayer lol