#help-development
1 messages · Page 1682 of 1
''
You can also just escape with \
oh ok
Can anyone help me with this?
?
You can very easily test it
Does calling damage with a source entity on a damageable call entitydamagebyentityevent?
I didn't want it to fire
Someone help me pls
how
setYield(2)
Is there a way to cancel a player right clicking? So say I want him to be able to right click once and not hold it, so he has to continuously click?
Like i know PlayerInteractEvent is cancellable, but how could I make it so he has to click multiple times and can not hold it
I cant convert from int to float
You can't
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Really? Not even by adding the player to a list and check if he is on that list and remove him once he stops clicking or something?
You can't distinguish between that and them clicking regularly
I guess you could assume anyone clicking exactly every 5 ticks or however far apart it is is holding right click
But you can't be 100% accurate
ugh that's just as stupid as not being able to check if left click is held down...
its client sided, if its more than 5 ticks its another interaction
The client doesn't tell the server every input
I mean players would be able to spoof clicking
damn, so I guess all pistols are fully automatic .-.
You could have some sort of toggleable mode
Auto or semi auto or whatever it’s called when it’s nor of those
that's reload xd
🥲
also horrible
That wouldn't work either with key repeat
Set the guns on cooldown or something like that.
double shift to crawl
what?
Oh sorry.
Like how do I add my plugin that contains a yml file?
You mean you want to implement a resource for your plugin
Embed it when creating the jar
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Do u use eclipse or IntelliJ?
I never used eclipse, is there a big difference in the process of creating config files?
eclipse
Not the very same at least lol
@eternal oxide
Please?
We need u eclipse guy
Exporting or using Maven?
what do you want to do now? Add a config to your plugin or add a plugin to your server`?
How do I add a config and add the plugin to my server?
alright, listen to ElgarL then
If you are not using maven and manually exporting your jar, put your plugin.yml in the root of your project. Then you have an option to tick what files to include when you export
I put it in the same package as my main, is that valid?
put it in teh root, same place your .classpath file is
Use IntelliJ with the minecraft plugin .-. So simple
@unreal quartz @quaint mantle I'm listening
to
to?
I'm here what now?
show your project folder
If your plugin.yml was in teh correct place it would be available on the right
idk you tagged me to say you were listening to something
Listening to your nonono reaction on my opinion
wat
I'm here now.
I see no plugin.yml
Should I paste it in here?
yes
How?
?paste
What should I paste it in to?
.
No, don;t "paste" it in this channel
No like in the folder.
Its not in yoru project structure
no folder it will 100% show up as an option. in a sub folder I don;t know.
Paste it in teh same place your .classpath is
then in Eclipse, F5 to refresh your project
Working is a whole other kettle of fish
What
Em dude my plugin say there is 0?
With no context that tells me nothing
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable()
{
}
@Override
public void onDisable()
{
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("hello")) {
if(sender instanceof Player)
{
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "Hey welcome to the server!");
return true;
} else {
sender.sendMessage("Hey console!");
return true;
}
}
return false;
}
}
There you go.
Nothing in there outputs any number
how might i get the server IP hte player is using when the serverlistping event is called
Number?
actually let me look
.
Ohhh the logs.
You are going to have to speak english for me to understand
What's wrong with my english?
From all this I have yet to work out any question you have asked
See no plugin?
I exported my plugin into my folder.
Not as a runnable jar file.
Looks like part of an exception at the top of that screenshot
But just a normal jar file.
could you provide the full logs?
You sure you don't hack me xD.
gonna hack ur stacktraces 
Ain't happening.
I'm not able to do anything with logs anyways
You sure?
well, other than helping you of course
You don't get my local ip?
I saw it for a few seconds. You have an error but I didn;t get time to read it
no
?paste us the log
[Server thread/ERROR]: Could not load 'plugins\myplugin.jar' in folder 'plugins'
We need to see it to help you
ERROR would have sufficed there
We can do nothing unless you show us the full error
That is the error.
it is not
OK, good luck with your problem
Bruh I just said it was the error.
It is not
and it is not
But if you don't want then fine :)
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.5
That?
you've got three people here telling you it's not the full error
gold medal for you
Yeah, I'm not fighting to get a simple log.
use api-version: 1.16 instead of api.version: 1.16.5 (I think that was it at least)
could also be api: 1.16, but you'll know it when you see it
export
you have to export it again, yes
Since the change must be present in your jar otherwise it's useless
just beware that you need to refresh your project because eclipse is dum with resources
https://paste.md-5.net/liqukateti.sql
ftr @rapid meteor that bit is called a stacktrace, the whole thing is generally what people are looking for when they ask you to "send the error" as it shows what methods were called, the error and a short message explaining the error
It finally works.
and no, you can't get "hacked" from a stacktrace
local ip?
well, in C++ (or any other non-vm language) you do coredumps, but java is thankfully a lot more advanced there (although - it depends)
I suck at Java.
I never do Java tho.
C++ = everyday all day.
xD.
I will warn you that you will need to learn to read stack traces if you wish to continue developing java.
I don't I just made this plugin for purely fun.
C++ pain
You're kidding.
You could be coding your stuff really defensively to avoid bothing to fix your crashes, but otherwise not something that is possible
depends on the OS. For windows yes, pure pain. Linux is better there
@rapid meteor I would recommend you to use intelliJ because imo it is easier for beginners, and also learn the java structure + reading stack-traces.
IntellIJ is a too heavy IDE.
Eclipse is light.
IntelliJ is actually worse from what I heard
and don't use windows
Why not
meh, eclipse is more confusing imo.
Eclipse is more beginner friendly overall
opinons 🤷♂️
I mean choose whatever ide as long as you still allow yourself to be open for changes imo
vscode
yeah, IDE won't matter in most cases
Speak for yourself.
LOL
Bruh
The conversation is ended mate.
You're a bit too late Santa Clause.
- has
yeah m a t e
'scuse me m a t e
bruh
from what I saw it seemed like he didn't know how to make a file
Lmfao
bri'ish
Then you've seen wrong.
they lacked in everything
I mean mkdir Folder is just soo easier.
cmd is my friend.
"should I paste it in here?"
UI > cli
whatever
yeah that makes a directory not a file 
then why use windows?
no bullying
I was referring to the file.
CLI and C++ should seal the deal
I said "should I paste it in here?" and showed a picture of all my folders.
Don't you think I mean't that?
What's wrong with windows?
microsoft™️
Windows 7 is great. Everything else is junk
because windows and CLI AND C++ don't go well
most linux system have GCC natively, which is a gift from god
Guys chill 🙂
why are you so salty:(
The conversation "has" ended a long time ago.
so is it possible to get the server ip that the player is using in the ServerListPingEvent
I’d say yes but unsure honestly
it has ended but no, I meant that he told you 3 times to make a file and you still hadn't.
You're still thinking about it, LMAOO
I won't :)
the ServerListPingEvent is the most important right now
I will if you ask nicely :)
we must honour it
Salute!
do not think so
from my 15 seconds at looking at the javadoc
?jd-bc
Or usage: /<command> ?
that needs to add the search box like Spigot has
?jd
@quaint mantle https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServerListPingEvent.html#getAddress()
declaration: package: org.bukkit.event.server, class: ServerListPingEvent
that's the playe raddress
thats their ip
Guys is usage: </command> right?
Wasn’t that what u wanted
i think they meant the ip the player is using, which i dont think is possible as its resolved on the client
Oh right
no
iirc just /<command>
the latter one from the first
Thank you thank you.
i know the client sends the hostname it used to connect to the server but i am not sure if or where the server stores that information
yeah
Ehm it doesn't work.
"Here we go again" you might think xD.
elaborate a bit more
Send ur plugin.yml
Alright!
?paste 
Hey, how would I save a Map<String, Set<Block>> to a config file? I tried a couple things and Im not sure what else to try.
doubt block is serializable
you may have to convert each set of blocks to a list of x, y, z for each block and set that under each key
damn
Block has getLocation() which is seralizable
So yeah not that much of a hassle lol
will have problems loading that if the world does not exist
just gonna change it to Location instead of Block
You could use the block values of a location
Im confuzzled
location allows decimal values
block locations, obviously, cannot have decimal values
but it shouldn't matter anyway
Ill just paste the code so you can see what ive been trying
If I were you, I'd keep using Block, but write a simple method to save and load yoru data to file. Block is perfect for your use
um
Why not just store teh players lockers in their PDC. then you have no data to save/load
I just wanted to do the saving/loading from a file once so I could use it sometime later, but that would also work
?paste
pfwoa are there better ways to do this?
https://paste.md-5.net/ogurigiviq.java
Yeah, write a save method, that loops the Set Blocks, getLocation() and saves as location, then the reverse for loading, as config has getLocation().getBlock()
same as for every player
ahh
PlayerJoinEvent, getPlayer and .hasPlayedBefore()
if player.hasPlayedBefore
dont do that
like so?
when you make the pc go to sleep
what PersistentDataType would I save it as?
Thread.sleep will block the main thread. This will just cause the whole server to stop.
what no
?paste
that’s not what he meant lol
so computer going to sleep is like Thread.sleep?
I dont know what you mean by "computer going to sleep"
oh
do you just have these lying around @eternal oxide ? XD
Show your plugin.yml
name: HelloWorld
author: Erawan
version: 1.0
api-version: 1.16
commands:
HelloWorld:
usage: /<command>```
indent useage
commands:
helloworld:
usage: /<command>
Ok thanks.
Wait does the name also have to be lowercase?
Like name:
Not sure if that matters. But if it does you wouldnt want to have a case sensitive command.
But what's the error?
When I do plugins.
It prints 0.
It should not throw an error.
Did you fix your plugin.yml and looked if it still throws an exception?
Let me try.
If your plugins throws an Exception on startup it will not be loaded. So 0 plugins
Is there any way to check when a player is within reach of an entity? Would be preferable if it was an event so I wouldn't have to deal with performance.
What do you mean by "within reach"?
subtract locations from each other and check how far it is?
every tick?
aka subtract the values
He wanted something that doesnt tank performance
It doesn't work please help me.
Uh. One more step back pls.
Show your plugin.yml and error
Are you planning on doing something when within hitting range?
There you go.
"Cannot find main class `dev.erawan.me.Main'"
Your path to the main class is wrong
Ehm no it isn't?
lol
Weird.
check for typos
I won't I'm just confused.
There you go.
is there anything inside the Main?
First: 2 whitespaces indents pls
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable()
{
System.out.println("Plugin is on!");
}
@Override
public void onDisable()
{
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("hello")) {
if(sender instanceof Player)
{
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "Hey welcome to the server!");
return true;
} else {
sender.sendMessage("Hey console!");
return true;
}
}
return false;
}
}
why so white
?paste
use the logger instead of stdout
Does it matter?
Will it affect the program?
yea white themes make you miss errors
no, but its much worse to use stdout
What do you mean?
Is it important to use spaces?
yaml only accepts spaces
LOL YAML is confusing,
in multiples of 2
I woulden't say its much worse to use sysout but like, you should use logger, won't change much tho
What about the commands: and helloworld one?
Do they need whitespaces too?
whitespace is to indent to indicate it is a child section
you only indent child nodes
Elgar is this how you use that PersistentDataType you sent me?
private static final PersistentDataType<PersistentDataContainer, Location> PERSISTENT_DATA_TYPE = new PersistentDataType_LOCATION(Lockers.getInstance());
IT WORKED WUHUHUHUH
Im trying to replace the block created by cobblestone generators. Any help?
if (event.getBlock().getType() == Material.COBBLESTONE) {
double RNG = (int)(Math.random()*((5-1)+1))+1;
if (RNG == 5) { event.getBlock().setType(Material.COBBLESTONE); }
if (RNG == 4) { event.getBlock().setType(Material.IRON_ORE); }
if (RNG == 3) { event.getBlock().setType(Material.GOLD_ORE); }
if (RNG == 2) { event.getBlock().setType(Material.COAL_ORE); }
if (RNG == 1) { event.getBlock().setType(Material.STONE); }
}
no
crap. its not giving an error tho
You use it eactly as you would any default data type
.getPersistentDataContainer().has(lockersList, PERSISTENT_DATA_TYPE)
this?
yes
why are you doing all this math?
so I have to make an object of the data type and then check that
for rng
So it randomly chooses a block
"5 - 1 + 1 "
you shoudl alwasy know teh type. you just don;t need a local variable of it
i got it from a forum post ok?
This will lean to even distribution which is usually bad for cobble generators:
private static final Material[] MATERIALS = new Material[]{
Material.COBBLESTONE,
Material.STONE,
Material.COAL_ORE
};
public Material getRandomMaterial() {
final ThreadLocalRandom random = ThreadLocalRandom.current();
return MATERIALS[random.nextInt(MATERIALS.length)];
}
Ehm bois when I do /helloworld it just logs /helloworld in the minecraft world.
your math literally wont work
thats a prime example of why you dont just copy and paste code
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
or some shit
ok then my Problem is: I dont know what to use so it recognizes the datatype.
nvm figured it out
in the set or get you use new PersistentDataType_LOCATION(plugin)
thanks for the help. Id be so lost without this discord and you guys XD
Kotlinify that shit (1..5).random()
thats disgusting
it's a range in a parentheses expression with a method call on the end
we can see that still disgusting
the parentheses are bc the parser isn't smart enough to 1..5.random()
import random;
import standard as std;
call main() {
std.println(random.randInt(5));
}
gotta use .ASS
I will never use .ass
Ok
if only it were so simple
it is
it is
if the println method is literally standard.println() without an import alias, that's a weird design decision
ThreadLocalRandom.current().nextInt(5);
^ what imagine said, best way
idk what to name it
it should just be println(), plain and simple
and why do you have to explicitly import standard
also: what is the point of the call keyword
😆
why not something more conventional like fn or func
i dont like func or fun
function
def (:
short simple
def is fine
❤️
im dumb
Same
call is just weird bc the function isn't a "call," it's a function
callable then.
there's a difference between callable and call :)
its a call because it pushes its return to the stack
Thank you thank you.
int a
double b
string c;
callable d;
I do like the whole callable keyword thing tho
maybe task
I dislike how function types like that are built into the standard library, not lang
they arent
Didn't work, what did i do wrong?
private static final Material[] MATERIALS = new Material[]{
Material.COBBLESTONE,
Material.STONE,
Material.COAL_ORE
};
public Material getRandomMaterial() {
final ThreadLocalRandom random = ThreadLocalRandom.current();
return MATERIALS[random.nextInt(MATERIALS.length)];
}
@EventHandler
public void onCobbleGen(BlockFormEvent event) {
if (event.getBlock().getType() == Material.COBBLESTONE) {
event.getBlock().setType(getRandomMaterial());
}
}
standard only include console stuff
could you use your brain for a second please
Ok
and realize I was referring to other languages
not yours
when saying that sentence
specify next time
as made obvious by the context clue of
you're confusing
method maybe
I like thing in this lang
I don't like this thing
you can assume that "I don't like this thing in other langs" bc I already said "I like thing in this lang"
Ok
help please?
I imagine it's probably the onCobbleGen method but idk
Why does this not cancel clicking in my GUI?
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
if (e.getInventory() != inv) {
return;
}
e.setCancelled(true);
}
inv is opened via player.openInventory(inv);
I think this is a better approach:
private static final RangeMap<Double, Material> MATERIAL_RANGE_MAP = TreeRangeMap.create();
static {
MATERIAL_RANGE_MAP.put(Range.atMost(50.0), Material.STONE);
MATERIAL_RANGE_MAP.put(Range.openClosed(50.0, 70.0), Material.COAL_ORE);
MATERIAL_RANGE_MAP.put(Range.openClosed(70.0, 80.0), Material.IRON_ORE);
MATERIAL_RANGE_MAP.put(Range.openClosed(80.0, 90.0), Material.GOLD_ORE);
MATERIAL_RANGE_MAP.put(Range.open(90.0, 99.0), Material.LAPIS_ORE);
MATERIAL_RANGE_MAP.put(Range.atLeast(99.0), Material.DIAMOND_ORE);
}
public Material getRandomMaterial() {
final ThreadLocalRandom random = ThreadLocalRandom.current();
return MATERIAL_RANGE_MAP.get(random.nextDouble(100.0));
}
Maybe if it’s a delegate
no you shouldnt but a bit of help would be appreciated seeing that this is the help-development channel
Help doesn’t inherently mean spoon feeding though
Use .equals instead of !=
Inventory is an interface
Inventory is not an enum
Ye
!= works unless you're creating a new one
Idk
I wouldnt bet on that
Bukkit does create delegates sometimes doesn’t it
im not a software engineer professor so i can only debug basic stuff
that has to be the dumbest reason ive ever heard
most IDEs come with debugging and even then he just means you should put debug lines everywhere like System.out.println(info);
You don’t need to be a software engineer professor in order to debug stuff
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
if (e.getInventory().equals(inv)) {
e.setCancelled(true);
}
}
Still doesn't work 🤔
soooo "it doesn't work" isn't helpful
i have literally never worked with random numbers how am i supposed to debug it thats why i only want help to understand it
Yeah because Bukkit inventories delegate equals to nms inventories which uses == iirc
public class MyInventory implements Listener {
private Inventory inv = null;
public void createInventory() {
inv = Bukkit.createInventory(null, 27, "hey");
}
public void show(Player player) {
if (inv == null) {
this.createInventory();
}
player.openInventory(inv);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory() != inv) {
return;
}
event.setCancelled(true);
}
}
this is how they teach it in the plugin wiki aswell
read this message #help-development message
That's what I'm trying to follow
🤦♂️
Anyone knows what I can put on the end at a "permission:" node?
string
dude you gotta stop being hostile, if you want help you gotta help us so we can help you
"myplugin.permission"
myplugin?
Don't I have to specify what permission like owner?
?
Yes, it is valid. I wouldn't follow that scheme though, do <plugin name>.permission instead (like pluginname.kit.owner)
I’d dissuade you from doing that
I don't know what's wrong with your project bc it's not mine, we're offering you advice so you can find the problem yourself.
Is your event registered?
🤦
Thank you...
🥲
The classic
lol
Yike
Bois why does it only print the command name????
it also did it at the other one.
It's stressing me!
Alright.
@still kindle Put getRandomMaterial()'s return variable on its own line, print it. Put a print in onCobbleGen to see if it even runs, if it doesn't, it means you didn't register your events.
That's basic debugging.
Any programmer can do that.
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable()
{
this.getCommand("kit").setExecutor(new CommandKit());
}
@Override
public void onDisable()
{
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
// Create a new ItemStack (type: diamond)
ItemStack diamond = new ItemStack(Material.DIAMOND);
// Create a new ItemStack (type: brick)
ItemStack bricks = new ItemStack(Material.BRICK);
// Set the amount of the ItemStack
bricks.setAmount(20);
// Give the player our items (comma-seperated list of all ItemStack)
player.getInventory().addItem(bricks, diamond);
}
// If the player (or console) uses our command correct, we can return true
return true;
}
}
And next time, listen when I tell you that debugging isn't necessarily complicated.
the command handler logic is in your main class, not the class you registered as the executor lol
did they leave lol?
I did register the class as .
CommandKit is the class
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class CommandKit implements CommandExecutor {
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
// TODO Auto-generated method stub
return false;
}
}
they blocked me kek
and you're returning null
😂
false
Should I return true?
It works now. Today is that kind of day sigh
Thank you
Greetings 🖖
that command is never ran
They're probably just having those "programmer at dead-end of project" stresses. Give 'em some time to cool down or whatever.
Hello fellow Dev 🙏🕊
Who is "they"? What did i miss. Where there multiple ppl here or something?
the return indicates if the command was used correctly, so if you return false then it will send the usage to the sender
??
How?
One of the people asking help in here, scroll up.
thats one of the messages
What should I do to fix it_
Ah i see XD
move the command logic to the command class
Me?
yes
not if i get insulted every time i do something marginally wrong in programming. programming is my passion and i hate when people ruin it
Nobody insulted you.
Hmm I’d assert there’s a difference between insults and advice. We just want you to be able to teach your very self.
Anyone teaching Java? I’m very new and want to get some help
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Fuck off Toby
I mean you can kinda argue Rack was being a bit rude, but in all fairness, it was a dumb reason, he just should've been more helpful right then and there.
Srsly lol
bit rude
Thank you everyone!
hello i'm trying to get player ping in scoreboard
with out flicker
so a made a runnable to change the scoreboard line
but it's spamming like this
https://prnt.sc/1revepa
For your help!
Dw he’s a good friend of mine 🤣
bit rude to put that knoife in me chest innit bruv?


Programming is going to be my whole life and if someone isn't going to be that helpful at all and more rude then I'd probably shit myself ya think
you are adding teams to the scoreboard not changing it
why does KillerWolf remind me of floofsy
What do you need help with good sir?
well how to change it
Hopefully he isn’t paranoid about his code jeff
lol

unfortunately i lack the capability of mind reading so i cannot see your code unless you send it
who?
silly - you cant mind read?
@quaint mantle
he goes under many names
What do you need help with
Some considered unnatural /s
unfortunately not 😔
Another guy which accused me of stealing his 100 lines long code
Oh Conclure you free actually?
Uhh it’s the Enchants we was doing
Replacing the cobblestone from a cobble gen with a random ore / cobblestone
Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
@Override
public void run() {
int ms = ((CraftPlayer)p).getHandle().ping;
obj.getScore(ChatAPI.color("Status: " + ms)).setScore(2);
}
},0,20L;```
this is the code
Like skyblock servers
If you’d like we could maybe call and I could show you / help you
Oh no it's fine i prefer typing :)
You could still type
Well that makes it 10x harder without spoon feeding
damn, wish I was as good a #help-development browser as you are
well that's just gonna set a score of 2 for each team called "Status: " and whatever ping you're on, meaning every time your ping changes it's going to add a new team with the updated ping
update a teams prefix and suffix
I should probably study Spigot's API
Questionable question
I know but im in a call rn so cant
👍
but is the questionable a question?
if it is supid enough, yes
like your mom? X D
-_-
ya mum
hey
I'm coding my website, and i wanted to add something like the total downloads from spigot on there, is there like an api or something that i can add the total amount of downloads from my spigot plugins?
ex.
yes
how?
two options
spiget is one API that I know of
spiget, or the prerelease https://github.com/SpigotMC/XenforoResourceManagerAPI
Is there a way to get the frozen overlay effect like the one used when in powder snow?
oh
um, okay ill try that ty <3
Hello how to get top 10 essentials balance top
with out using /baltop
Just look at the src code of EssentialsX
Not sure if everything is accessible. So it might not be possible at all.
okay thx
One way would be to implement your own CommandSender then let it run the command
and parse the given result.
I just threw this together:
https://gist.github.com/Flo0/d30920ec1c2b0e10ce862c0fb79ea6f6
@Override
public void onEnable() {
Bukkit.getScheduler().runTaskLater(this, () -> {
final ConsumingCommandSender sender = ConsumingCommandSender.withConsumer(msg -> this.getLogger().info(">> " + msg));
Bukkit.dispatchCommand(sender, "help");
}, 40);
}
Yields
This way you can basically poll the output of any command.
Could be used to fill holograms for example
I really wonder how many plugins you made in order to test what you are suggesting
Its just one with dozens of branches. "SpigotSandbox"
even worse
?paste
any good suggestion to save
data on block
I need to save which tier block is on restart
I tried block metadata
but it is deleted on restart
will that work on 1.8
Shoo 1.8 pleb
wait does PDC work on normall blocks
no, that uses the Chunk PDC to store the blocks data
its just a nice clean wrapper
Force them to update
convince them to update
If you don't help then they have no choice
or look at NBTAPI
and when the next dev comes in for help we'll tell them to update
Does writing to the NBT data of a chunk even work in 1.8?
there is option for NBTFile in api
that could work
tell em the jobs impossible
I mean, just storing something into a db is also pretty fine
thing is it is enchant which can transform blocks to next tier
obviously requires you to cache a lot more compared to a fully in memory PDC
and then same block have change to go again to next tier
I will see probably some db will be solutin
I was looking for something simple xd
Redemt saves its block data in a db and lazily loads it on the first interaction with a chunk.
If its done with SQLite and you dont risk an external DB blocking then this is a viable option.
thanks
how do I get the location from this configuration section? ```yaml
user:
7b5c354d-e997-4c27-b4bc-936c16c868fd:
world: world
X: 57
Y: 68
Z: 181
Probably getConfig().getLocation("user.7b5c354d-e997-4c27-b4bc-936c16c868fd")
Should work
i'm trying to save blocks placed by users so can I just do getConfig().getLocation("user") ?
🧐
ok
Get the ConfigurationSection "user" + playerID.toString()
Get the world as String
section.getString("world");
Get x, y, z as ints
section.getInt("x");
section.getInt("y");
section.getInt("z");
Get the world from the String with Bukkit.getWorld(worldName);
Construct a new Location using new Location(world, x, y, z);
doesn't location has this deserialisation process built in?
yes
If you plan to track every placed block by a player like this then it will be insanely inefficient.
the blocks get deleted on break
His structure doesnt look like its deserializable by Location.
Doesnt matter. This will be potentially millions of config entries per player.
ConfigurationSection getLocation just looks for keys I believe
not a true deserialization
My structure is java this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".world", event.getBlock().getLocation().getWorld().getName()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".X", event.getBlock().getLocation().getBlockX()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".Y", event.getBlock().getLocation().getBlockY()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".Z", event.getBlock().getLocation().getBlockZ()); this.saveConfig();
god no, if you are saving teh config on changes too
any better suggestions?
your server will crawl to a standstill on every block place
This can be one line
Do you just want to track which block were placed by a player?
yes
https://github.com/Flo0/PlayerBlockTracker
You can look at this.
How do you spawn a falling block as world.spawnFallingBlock() is deprecated
it isn't ?
Only one of the 3 methods is deprecated
Yea, the one using magical sub ids is deprecated
The one using bytes as data...
What is the velocity of gravity for players?
Location location = ...;
World world = location.getWorld();
BlockData data = Bukkit.createBlockData(Material.STONE);
world.spawnFallingBlock(location, data);
You mean the acceleration?
Yes
Thanks
I believe ive written a test for that. It actually changes with the y velocity of the player.
The curve suggests that air friction increases quadratically with velocity.
wow that api is everything I needed
thanks
Hey, quick question: I'm trying to connect my project to a MySQL database via a DataSource and have created the following class for it so far:
public class MySQL {
private DataSource initMySQLDataSource() throws SQLException {
MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();
File file = new File("D:\\Programming\\Plugins\\Config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
dataSource.setServerName(yamlConfiguration.getString("host"));
dataSource.setPortNumber(yamlConfiguration.getInt("port"));
dataSource.setDatabaseName(yamlConfiguration.getString("database"));
dataSource.setUser(yamlConfiguration.getString("user"));
dataSource.setPassword(yamlConfiguration.getString("password"));
testDataSource(dataSource);
return dataSource;
}
private void testDataSource(DataSource dataSource) throws SQLException {
try (Connection conn = dataSource.getConnection()) {
if(!conn.isValid(1000)) {
throw new SQLException("Database not connected!");
} else
System.out.println("Database connected!");
}
}
}
Unfortunately, I do not know exactly how to establish a connection to my database in the Main class. (I created the class with the help of this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/?__cf_chl_jschl_tk__=pmd_iP2VT4IVi_Tkf4BAPtcQGHjdHLSTBiGBgJmCYQ3aHd0-1630959702-0-gqNtZGzNAfujcnBszQkR . However, I can't get any further at this point).
Could someone explain to me what exactly needs to be in my main class? Thanks in advance!
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how do I get the drops of e.getBlock.breakNaturally?
Has anyone coded with GriefPrevention before?
What do you mean by drops? Like what material it is?
yes, whatever drops when you break a block is what I need to add to the player's inventory
don't think there is a straight forward way to grab it. You might be better off getting the drops for the used tool
and then just set the block to air and play some particles
Question; Why would you want to drop the block naturally if you are going to add it?
I don't, I just need to get whatever would drop if I broke the block
{
event.getEntity().remove();
((CraftWorld) event.getLocation().getWorld()).addEntity(rideableDolpho, reason);
event.setCancelled(true);
}``` so I made this if statement and it works but literally no dolphins spawn now at all
e.getBlock().getType()?
if I broke stone, that would give me stone not cobblestone
Block#getDrops(ItemStack, Entity)
Block::getDrops
declaration: package: org.bukkit.block, interface: Block
ok thanks
it will take into account fortune etc. if an item is passed
how about breaking the block? I can't set it to air as players will have infinite durability on pickaxes/ axes
why not listen for a block break event then
assuming you only want thsi behaviour when a player breaks a block
wait my brain was clogged
I got it
I feel like im doing something wrong
but idk what it is
can someone help me?
if they can
how do I get 1 block above e.getBlock().getLocation()? do I use .add()?
.add(0,1,0)
how would I drop the item where there isn't a solid block? basically checking around all 6 sides
use getRelative to check each location
ok
?paste
I have a hashmap for faces and I loop through them and spawn it at the face when the block above the face is air https://paste.md-5.net/ewolefized.cs
it doesn't work and I get 1 item
You are not spawnign at teh tested location
e.getBlock().getRelative(BF.get(i)) is your tested location. You are spawnign it at e.getBlock().getRelative(block.getFace(block))
ah
doesn't seem to be working with e.getBlock().getLocation().getWorld().dropItem(e.getBlock().getRelative(BF.get(i)).getLocation()
um, why are you looping these blockfaces, but if its not air you break the original block?
a better question, what exactly are you trying to do?
I moved that down
give people 2x the items on block break
just 2 times?
yes, I just drop an extra on block break
Then use teh BlockDropItemEvent
I have it working so it drops an extra item on block break
this is my code now: ```java
for (int i = 1; i <= 6; i++) {
if (e.getBlock().getRelative(BF.get(i)).getType().equals(Material.AIR)) {
if (item != null)
e.getBlock().getLocation().getWorld().dropItem(e.getBlock().getRelative(BF.get(i)).getLocation(), item);
}
}```
Why are you using any of that if all you want to do is drop 2 of something?
so it doesn't drop inside of a block and get teleported upwards
then use teh correct event
@EventHandler
public void onDropItem(BlockDropItemEvent event) {
for(Item item: event.getItems()) {
ItemStack drop = item.getItemStack();
drop.setAmount(drop.getAmount() * 2);
item.setItemStack(drop);
}
}```
ok
rather than setting the amount you could simply use two drop method calls
but that will do what you want and simpler
it will also double up anything extra gained from enchantments
tidier
How to make frosted ice that ages and doesn't leave water behind?
still having issues with replacing an entity with my custom one
I seriously don't know why this is happening
Maybe store ID of custom entity and if a list/set doesn't contain the ID, then stop the dolphin from spawning
the thing is like it either gets rid of any dolphins or the dolphins stay the same
Im just checking whether event.getEntity.equals(Dolphin.class)
but im not sure if that will check for subclasses too
like instanceof
comparing an Entity instance to a Class with .equals? Not good
if (event.getEntity().getType() == EntityType.DOLPHIN)
but my custom dolphin shares the same entitytype
so it will then remove the customdolphin as well wouldn't it
should I give it a different EntityType?
first make sure its actually a dolphin properly, then check instanceof to Your entity class
check instanceof?
yes
could you elaborate im a bit confused sorry
instanceof is a class type comparison
you have to see if its your dolphin or not
or the minecraft dolphin
your dolphin as they are both instances of an MC dolphin
I'm assuming you have extended the MC dolphin
yes
in your own class
How do I make a public Inventory so all classes can see it.
add public in front of the method or variable
add a getter
Wouldn’t use a getter in this case
...
im trying to log when players take items from an inventory block but get stuck when they double click and shift an item moving more than a stack into their inventory and InventoryClickEvent goes off for how many stacks was moved. how can i get around this
The first bit makes 0 sense
Just remove it its going confuse people
and only include what you're trying to do
but as for your answer
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
ok thanks
Can someone help me please. I was trying to follow a tutorial on how to create something in a plugin and I did everything and loaded in the game, but when I type in /plugins to see if my plugin is there it does not show up there. Just to say it is in my plugins directory for my server. In the plugin I attempted to create a custom command and that does not work too, I think the plugin isnt running or getting used for some reason.
Well if its in the plugins folder and doesn't say in the "pl" command, then there is 100% an error in the console.
And without seeing it, we can't help you
No, we need the error it shows above that
?paste
how could i raycast the players line of sight? never done raycasting befpre
You need to update your java version on the server
or downgrade the java version on your plugin
Both of them use 1.16.5 minecraft version
is there a way to know what java version I am using for my server? And how do I downgrade or upgrade the java version on my plugin
well one is 59 and other is 52 i think 52 is Java 8 and 59 is Java 15
I have a method that drops 2x the blocks, I use the api PlayerBlockTracker which tracks blocks placed and I untrack the block when it's broken. I get 2x the blocks either way however.
https://paste.md-5.net/fasihijuyi.cs
How would I upgrade my java version for my plugin?
Are you using maven?
I dont think I am
is there a file called pom.xml@quaint mantle
Where would that be located?
ill take that as a no
a no then ok
ok
check when the server starts up is there any errors that come up
I had this working at one point, why isn't it working now?
you need to setup a maven project
Do I have to recode my entire plugin?
no, copy your code over
World#raytrace iirc
ok
You don't have to copy anything, just change the project to java 8
I don't know, I haven't used eclipse in forever
Just look up how to change the java version of a project in eclipse
Ok
you should use intellij then unless you're set on eclipse, intellij is able to create a maven project for you or you can install https://plugins.jetbrains.com/plugin/8327-minecraft-development for intellij
with that plugin you can create a spigot skeleton project
The one reason im using eclipse and not intellij is the fact that I dont know how to code in java at all the with most of the tutorials im watching its in eclipse
that disappoints me
I gotta make a proper tutorial in intellij screaming at static abuse one day
you should learn a bit more and the ide doesn't improve your java knowledge
ok
you just need to get familiar with your ide
Is someone able to help me here?
Why? That plugin is amazing & saves so much time
I suppose if you have a template with all ur utils and stuff then yeah
but otherwise it's really good
ehh not really
I kinda have a folder with utils but I copy it over manually
Each customer has their own needs and not everything is done the same
Even then maybe half my plugins work on spigot
that plugin has only ever caused me issues
I don't use the spigot intellij plugin
I'd never recommend the InteliJ MC plugin to any beginner
What does it do?
learn to walk before you take shortcuts
What does it do though
setup maven and stuff
screw you spigot
Creates a plugin template you build on
yeah
But it uses Main as teh main class for a start 😭
teaches bad habits from the outset.
same
I always name mine like