#help-development
1 messages · Page 1737 of 1
for example every 5mins or something like that?
No, you only save when something changes
You can also have an async runnable that saves the data every so often
That works too
well, i'm doing a stat plugin, it should change many times
GroupManager uses a combination of the two, it saves any changes every 10 minutes, or on restart/shutdown
Yeah I like to save on a schedule, disconnect, and shutdown
i think that's the best way?
just have a flag in yoru player data holder for boolean changed;
any time you update a stat you set teh flag to true
You can save it async without trouble, so it’s probably fine
when you save you reset teh flag
that way when it comes time to save you only save those with a set flag
Not a bad idea
async?
Might consider that for database work in the future
Or just send updates as things change, idk
?scheduling
i can't do a task in static tehe
I think that touches on async runnables
i see
Basically you can save the data in memory to the file off the main thread so you don’t block anything
tehe
?
Programmer socks here is very giggly today
I'm sober I swear
Ah yes, the programmer intoxication
or do you have a tutorial for it?
Hey, i want to take from the config.yml a Double Variable and then write it on a .yml file but it throws this error in the IDE Project Errors createSection(java.lang.String, java.util.Map<?,?>)' in 'org.bukkit.configuration.MemorySection' cannot be applied to '(java.lang.String, java.lang.Double):
public class JoinEvent implements Listener {
private Main main;
public JoinEvent(Main main) {
this.main = main;
}
@EventHandler
//Some Code here
File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("PerPlayerBorder").getDataFolder(), File.separator + "PlayerDatabase");
File f = new File(userdata, File.separator + playerUUID + ".yml");
FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);
if (!f.exists()) {
try {
//Some Code
Double StartingSize = main.getConfig().getDouble("StartingBorderSize")
playerData.createSection("WorldBorderInfo.Size", StartingSize); //The Error appears on THIS line
playerData.save(f);
} catch (IOException e) {
e.printStackTrace();
}
Can anyone help me?
Probably this is a stupid error but im new to Java
ping pls
i tried with String and Integers too
so how can I fix it?
You don't need to directly create sections
You can just do set("section.thing", "value") and section will be made automatically
omg i realized
im so stupid
i wanted to use .set() and i didnt notice that i was using .createsection()
can anyone help me with this pls?
Does exactly this patch (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse/CraftBukkit-Patches/0060-Prevent-NoClassDefError-crash-and-notify-on-crash.patch) fix StackOverflowError, which can be caused by update comppressor? If yes, can i simply remove this handlers from this patch for update suppressor to work?
Is it possible to make ghost blocks within spigot?
Send a block change to the server but send a packet to the player that its not changed
Or vise versa
Player#sendBlockChange
I've been making a commission for a friend and recently bumped into this weird problem with ExactChoice class, where whenever I try and using with custom items that exist ingame, it does not let me use the RecipeBook system to automatically put the ingredients in their place since its a ShapedRecipe.
HOWEVER, whenever I have the item in its vanilla form it does let me use it in the RecipeBook, but it won't actually craft, because its not the item intended to use that custom craft I created...
that is a better question rather than "HELLO ANYONE HERE?"
Guys is it possible to create event with lamda? Something like this Bukkit.Event<BlockBreakEvent>(event -> { });
Answer is yes its possible just like Trumpeh team created GUI events inside lambda
But why'd you do that?
i don't know yet
okay, looked at the wiki.vg code and stuff, and I cannot find a real reason to why it does not work. Will look at cb code in a bit
i'm just curious
@quiet ice I seriously tried anything possible, People told me it works on shapeless recipes rather than Shaped ones, but in the docs it says the opposite
ExactChoice should not work on shapeless recipes, that's written in bold in the docs iirc. But then again bukkit's docs are questionable to say the least
IKK
Look at my post in Spigot https://www.spigotmc.org/threads/exactchoice-conflicts-with-recipe-book.530192/
Like I am not new to Bukkit/Spigot API's
I do it for 5 years I aint asking small questions this one is particularly questionable
Yeah the client is probably to blame for that
I blame everything on client when it comes to Minecraft tbh
But this specifically sometimes work and sometimes doesn't
As I saw on forums
Because funny part of this
@young knoll
https://gifyu.com/image/eT05
Here it does show the custom item needed for the recipe
But
Auto Item replacement
Nope
https://gifyu.com/image/eT0r
Here the auto replacement works but with the wrong item
if that's the case then the client knows about the recipe but is too dumb to actually perform the action. That being said, it could also be that the server has to perform these actions, but I do not think so
either way, you are probably not at fault here and it's either the server messing something up (unlikely, would need to read the protocol a bit more thoroughly to be 100% sure) or the client messing something up
I have looked at that a while back and came to the conclusion that it is likely possible albeit with a lot of pain. Would def. need to take another look at it however
Looked into some docs before too, I do not look deep in the protocol docs but it does seem like I cannot change actual state of RecipeBook of a player.
Which sucks
Shows how much this game need to be reflatten
@gleaming grove took a closer look at it and the answer is no: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/RegisteredListener.html
Saw this class before
meh i came to same conclusion
actually, you could override the RegisteredListener#onCall method
I think you could possible use callEvent
actually yes, with a bit of handlerList hackery, it is fully possible
like i would need to add element to handlerList with reflections?
Jacek if you only want a lambda as an event executor check out EventExecutor, or are you creating custom events?
SimplePluginManager#registerEvent(@NotNull Class<? extends Event> event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) might be it tbh
^
it does the reflection stuff for you already and sets up timings!
I don’t think it does any reflection
SimplePluginManager#getEventListeners does however
Anyways here you need something which keeps the type at runtime since it’s going to be erased otherwise
my goal is only to use lamda
you'd still need to pass a class here
^
I thought to use this
to get type from pure generic type
i have not test this method yet, its from stackOverflow
Bukkit.getPluginManager().registerEvent(PlayerJoinEvent.class, new DummyListener(), EventPriority.NORMAL,
(listener, event) -> {
}, this);
that being said I do not know if that already filters out the right listener / event type
ok i going to test it
My main lanuage is C# so i don't know what i'm doing wrong. Why this is not working?
Hi! I am coding a plugin in intellij IDEA, and i am doing my first plugin. But i need help, because when i try to generate the .jar file with Build > Build artifacts > build and it doesnt generate it. But it says this error in build output and i dont understand the error, can someone help me please?
C:\Users\ondre\IdeaProjects\FirstPlugin\src\net\diamondlands\MyFirstPlugin.java:7:12
java: cannot find symbol
symbol: class voice
location: class net.diamondlands.MyFirstPlugin
idk looks kind of ok to me
@quaint mantle post your MyFirstPlugin.java class
you have a variable voice not defined
package net.diamondlands;
import org.bukkit.plugin.java.JavaPlugin;
public class MyFirstPlugin extends JavaPlugin {
@Override
public voice onEnable() {
System.out.println("Plugin enabled");
}
@Override
public void onDisable() {
System.out.println("Plugin disabled");
}
}
the return type of onEnable looks wild tho
generics for methods come right after the dot
yup that'll do it too
So it would be FluentEvents.<PlayerMoveEvent>onEvent([...]
... XD
it looks super cursed though, mostly because you should rarely make use of this
my T extended PluginEvent insted of Event
that was the reason why it i got error when i placed T after dot
me too
MD_5 will ItemStack.serialize() and ItemStack.deserialize() ever be fixed?
So I just started wrting my own seralizer but basically the ItemStack.serialize() method doesn't work on items that have meta data. Like display name, lore, enchants etc...
yes it does
When you run ItemStack.deserialize() with the json string it errors.
well for starters deserialize takes a map not a string
and that would be because you didn't deserialize the map correctly
- it definitely works fine with yaml (as evidenced by getItemStack in yamlconfig)
I asked about this ages ago. I can't post code currently so I will later.
But yeah I used the Json sting parsed to a map
the default .toString() implementation of map looks a lot like json but isn't actual json, make sure you serialised to json properly
there was someone a while back that did the exact same error
No I actually used json methods. Even GSon
"xyz doesn't work please fix it"
ah then, idk
you likely cant just throw it into gson
you'd need to implement the ConfigurationSerializable machinery to unserialize custom types
I'm sure someone has already done it for gson
Your code was <#help-development message> right?
or just use yaml lol
how do I get the closest entity to a block
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double), then use DistanceSquared to get the nearest
- getNearbyEntities 2) find distance 3) pick lowest
Yes
Not using yaml
I should really troubleshoot my copy & paste issues one day
Using json
Valid json is valid yaml (:
ItemStack.serialize() isn't valid or ItemStack.deserialize() just doesn't work right.
Also another issue with ItemStack.deserialize() if the item has enchants it won't set the itemmeta
if (args.containsKey("enchantments")) {
} else if (args.containsKey("meta")) {
}
because enchants are in the meta
only stuff serialized in like 1.6 has the enchants key out the meta
you would also see this by reading the comments in the itemstack source file
In 1.17 though, it contains meta and enchants
Ah yeap. Doesn't.
Issue still stands on the Gson code above.
because you cant just dump it into gson
you need to at the very least add a type adapter for ConfigurationSerializable
At that point I might as well just keep my own serializer method. Since it converts to a string or map and back to an item.
how can i get World object from worldInfo object?
World is a subclass of WorldInfo\
that is? can i get the world object through it somehow?
when it comes to casting, that's not what I mean
All worlds are worldinfo
casting is the only way
@quiet ice i gave up with getting class type from generic type, anyway thanks for help lamda events work ;D
I have worldinfo and I need to create a location from it
[00:29:34] [Server thread/ERROR]: Cause of unexpected exception was
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.generator.CraftWorldInfo cannot be cast to class org.bukkit.World (org.bukkit.craftbukkit.v1_17_R1.generator.CraftWorldInfo and org.bukkit.World are in unnamed module of loader 'app')```
then i download this world from location and create craftworld
and I have these errors
so how can i fix that?
I have an error with bedwars 1058, I set the store place and the upgrade store place, but the npcs don't show up at the time of departure and there's no way to use the stores, someone help me please!!!
you cant turn a worldinfo to a world during generation
you need to rethink your generation
no, Tusoo
ok
Also this is a development channel as the name suggests
have you tried asking the author
How can I send a TextComponent in a kick message?
trying to put a click to copy text in it
ok
*or use nms for that and never open a feature request 😎 *
Hi, is is possible that i can use forwarding with plugin messaging chann with 0 players online on a server?
no
Oh okay.
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
if(meta != null && meta.getLore() != null) {
if (meta.getLore().contains("§6Lightning targets nearby entities")) {
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
for (Entity target : nearest) {
if (target instanceof LivingEntity && target != player) {
player.getWorld().createExplosion(target.getLocation(), 50);
player.getWorld().strikeLightning(target.getLocation());
}
}
}
}
}
}``` anyone know why this just doesn't want to work?
what's not working
nothings happening
is it registered?
wdym
omg i forgot lol

Yo what am I doing wrong args = ["${project.parent.parent.projectDir}/version/Utils.jar", "outputDependencies", "--minecraftDir", System.getenv('MINECRAFT_HOME'), "--version", version, "--output", project.parent.parent.projectDir.absolutePath + "/version/temp/classpath_" + version + ".txt"] ```> Illegal null value provided in this collection: [C:\Users\User\IdeaProjects\Util\version\Utils.jar, outputDependencies, --minecraftDir, null, --version, 1.8.9, --output, C:\Users\User\IdeaProjects\Util\version\temp\classpath_1.8.9.txt]
and yes I added MINECRAFT_HOME to my system variable
Hi so dumb, I'm Mom.
milk
is there a tutorial anywhere to add version specific code like 1.8 i want it to do ... and 1.16 i want it to do...
still wont work
:/
Main plugin;
public LightningWand(Main plugin) {
this.plugin = plugin;
}
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
if(meta != null && meta.getLore() != null) {
if (meta.getLore().contains("§6Lightning targets nearby entities")) {
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
for (Entity target : nearest) {
if (target instanceof LivingEntity && target != player) {
player.getWorld().createExplosion(target.getLocation(), 50);
player.getWorld().strikeLightning(target.getLocation());
}
}
}
}
}
}``` this dont work
send main class
this.getCommand("giveLightningWand").setExecutor(new Commands());
this.getServer().getPluginManager().registerEvents(new LightningWand(this), this);```
console errors?
theres no syntax errors
try desk checking (put broadcasts or system out prints in each if statement) to see if it is registering
idk hwo to check console
how do I broadcast
Bukkit.broadcastMessage(message);
and if the number or message doesnt go off
u know where to fix
also is this ur first time working on servers/plugin dev?
chat
add it to the top of the event to see if its registering
whoop
and I would recommend having the broadcasts in numbers so its easier to track
its not even registering the event lol
send ur entire main class and event class
i have
another item
i created
so just ignore it
package me.pure_bacn.magicraft;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("Plugin Running! :)");
ItemCreator.init();
this.getCommand("giveHomingBow").setExecutor(new Commands());
this.getCommand("giveLightningWand").setExecutor(new Commands());
this.getServer().getPluginManager().registerEvents(new HomingBow(this), this);
this.getServer().getPluginManager().registerEvents(new LightningWand(this), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
System.out.println("Plugin Stopped! :(");
}
}
👍
package me.pure_bacn.magicraft;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.List;
public class LightningWand implements Listener {
Main plugin;
public LightningWand(Main plugin) {
this.plugin = plugin;
}
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Bukkit.broadcastMessage("Event Registered");
Player player = event.getPlayer();
ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
if(meta != null && meta.getLore() != null) {
Bukkit.broadcastMessage("Lightning Wand");
if (meta.getLore().contains("§6Lightning targets nearby entities")) {
Bukkit.broadcastMessage("Lightning Wand");
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
Bukkit.broadcastMessage("Clicked");
List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
for (Entity target : nearest) {
if (target instanceof LivingEntity && target != player) {
player.getWorld().createExplosion(target.getLocation(), 50);
player.getWorld().strikeLightning(target.getLocation());
}
}
}
}
}
}
}```
so are there any errors in console
nope
is the other item working?
yes
what version are u using
yea if the other one is working it shouldnt matter the version
yea
well its more to see if its registering
any chance ur PlayerInteractEvent has a line through it?
it registers for me
Does Spigot have support for custom sound paths? e.g. if I send the player a resource pack with sounds that aren't part of the Sound enum, can I still send a packet that says to play those sounds a la /playsound?
is it cuz the plugin is outdated?
o
it would be spitting mad errors if it was outdated
check ur pom.xml
idk where to find the version
makes plugin: doesn't know what version the plugin is, gg
also doesn't know how to check the console apparently 
😢
technically you don't need to add api-version, it'll just yell at you in console about you using a "legacy" api version
o
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.Pure_Bacn</groupId>
<artifactId>Magicraft</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Magicraft</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
```
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>```
sorry for puting it in java
habit
lol
r u running a localhost?
or using online hosting
if localhost, ur console is the CommandPrompt
then its ur terminal
kinda looks like this https://gyazo.com/a328f7ab90fee9a4d067b2fbf8790bb8
except mac-y
🤦♂️
before you get into events and stuff i would recommend starting from the basics
but my lore no match
change ur lore then
i learned the basics from this guy
https://youtu.be/Hrg9_3DBQ90
Check out this plugin featured in the video here:
https://www.jetbrains.com/idea/
https://plugins.jetbrains.com/plugin/8327-minecraft-development
View all our plugins here:
https://www.spigotmc.org/resources/authors/111582/
https://www.mc-market.org/resources/authors/50438/
Check out BGHDDevelopment!
https://bghddevelopment.com
Come hang out ...
i mean like it has the same text
yea but did u use ChatColor.GOLD?
Why is the thumbnail javascript
i meant the bacn guy
§6Lightning targets nearby entities
who knows
I think codedred might be better than BDGH
Its better to create a method to auto-translate color codes
:/
Don't use the weird lookin squiggly symbols, use ChatColor :)
ok
ChatColor is ideal, but it is annoying
how to use chat colour
or make a function
ChatColor.GOLD + message
ok
Use translateAlternateColor codes or something like mini-message
Or the ChatColor enum
like i tested ur code with
List l = new ArrayList();
l.add("§6Lightning targets nearby entities");
ItemMeta meta = ((Player) sender).getItemInHand().getItemMeta();
meta.setLore(l);
((Player) sender).getItemInHand().setItemMeta(meta);
public String color(String s){
return ChatColor.translateAlternateColorCodes('&', s);
}
This little beast has helps a lot
Make it static :p
smh static abuse
It's a utility method
yea
It should be static
true
It's the first method I actually create when making a project, and probably the method that is called the most
its still not registering the lore
do I have to do the chatcolor when matching
ya
bruh
still not registering the lore
ok imma try comparing display names
what the flippers
why is the world corrupted
Hi, new to Spigot and trying to grab stuff from another plugin (LuckPerms). I read about Vault and see it doesn't support that, is there something else for it or should I do it directly?
LuckPerms should support vault
I didn't see it listed on https://www.spigotmc.org/resources/vault.34315/
50 is nothing, if your sever dies at 50 you need a better server lol
That page is old
huh
what is 50 them
*then
No I mean the explosion power
yea i mean
how much is 50
explosion power
like how much compared to normal
tnt
or creeper
Normal tnt is 4
There is something else going on if that is the case
What world data are you referring to?
like pretty much wiping everythin
like basically reset it
You want to delete it or restore it from a backup?
delete it
Or regenerate the seed?
regenerate
You would need to delete the world folder and re create it using Worldcreator
can u send me link to world creator
oh
declaration: package: org.bukkit, class: WorldCreator
how do I do something like this? (there are alot of server that I've seen do this before hypixel but they are the only example I can remember)
Just get the name and seed before deleting and pass that into the world creator
Is that possible for hypixel to be on maintenance?
Because I've never seen such thing
?
ok
It's happened a few times
how do I grant immunity for a couple seconds
setNoDamageTicks
I've seen ALOT of servers do it before hypixel
to like a single player
Yeah but I've never seen hypixel do it
setNoDamageTicks
ok
packet magic
;-;
I know but how
how many ticks in 4 seconds
I'll have a look thanks
a second is 20 ticks :)
ok
seems to be it thanks, time to learn bungeecord lmfao
Anyone can hook me up with the best CommandAPI possible?
make your own or just steal one off github
Making one = what am I, a human being?
Stealing one = Just a normal Java developer ;-;
what type do you want?
The one that gives me control over everything including subcommands, subcommands description, deep permission checks etc.. etc..
but like annotations ect
Yep
Already using lombok need to evolve more
Really good one tyvm
np
everyone knows aikar
Yeah lol
I just didn't notice the name saw the face first
And I was like I Recognise this github profile
It may not work for long durations
I’ve never used it for more than a few ticks
But it should?
is it technically illegal to hide code in the back of a plugin that ops you on join or gives you ability to kick all players
Illegal? Probably not
illegal? who knows
Will it be allowed on spigot? No
will it get you banned? yes
Hotel? Trivago
Ik u shouldn't do it, i just want a legal standpoint :)
Ask a lawyer
doubt anyone can answer that for every country on the planet
Usa
Idk any
legal would depend upon any damage (financial/loss of service) it caused
No damage
legal advice here is against the rules
Well I don’t think any of us are American lawyers
Oh dam
criminal law doesn't require damage 😉
IANAL
Ty
ThIs My PlUgIn I'lL dO wHaTeVeR i WaNt, InClUdE bAcKdOoR
and if you do upload malware onto spigot, I'll ban you myself
Time for a bad life pro tip
Claim your plugin has malware to force option to check it and get you an extra download
only one, spiget's download lol
So spiget is basically a user
I wonder how many files I'd have if i were to do a mass-scan now 🤔
at least 1
we'll see, it has fancy stats once it's finished downloading resources 😂
I call that bs I got a lawyer and he says backdoors are allowed as long as you got allowed for backdoors
Ban yourself than ban him
Downloading's always the slow part 🤣
Is your internet at least better than mine
Dunno
whats the best way to go about making a sign shop plugin? I have a rough idea but im not sure how to do it
its easy when you have a plan
on sign interact -> get chest behind -> load the item's price and owner
use pdcs to handle all of that
?pdc
I was more so thinking of remaking the essentials sign shop where its just a sign
but im unsure how I would change whats on the sign would it also be in the PDCS?
on sign interact:
line 1 = sell / buy
line 2 = price
line 3 = item
alright cool that helped alot 😄 ima write up some pseudo code then start working on it 😄
placing a sign is in block place event right
Wonder if all items will fit on a single line of a sign
Yes
alright cool 😄
There is a SignChangeEvent for when the text changes
alright thanks for the heads up, ill add that as a failsafe for people who are editing signs
Downloaded: 3043, noNewUpdate: 27994, oldUpdateMoved: 377, downloadError: 3 moveError: 0, moveNotExist: 2, skippedExternal: 4045, skippedSkript: 5714, skippedFileSizeZero: 22, skippedNoSize: 17 other errors: 0
File size 0?
I’m surprised they let you upload that
Upload what?
An empty file to spigot
True
Pre cleanup: 33,440 files
Post cleanup: 33,031 files
List<String> strings = new java.util.ArrayList<>(List.of(args));
StringBuilder stringBuilder = new StringBuilder();
strings.remove(0);
strings.remove(0);
strings.remove(0);
better way to remove the first 3 arguments in an array?
for int i = 0; i < 4; i++ strings.remove(i)?
how do i set vaule in config.yml from another class?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
requested page cannot be found
i was typing that, just found the correct one
replaced already 😦
Wsp m back
Yee
hey why cant I get any strings from my sign? I'm using
void onSignCreate(SignChangeEvent e) {
Block b = e.getBlock();
Sign sign = (Sign) b.getState();
System.out.println(sign.getLine(0));
I am working on a plugin inspired from dream's latest video
what the plugin does is that it assisngs a random way to die in 5 min between 2 players and whichever player fails to die in the way assigned loses.
what I am doing in my plugin is I am generating a random way to die for the players and listening for deaths
if the player successfully dies in the way specified, I set the boolean ahascompleted to true
and the same for the other player b too
after the delay of 5 minutes I am checking if the the boolean ahascompleted is true or not
and same for bhascompleted however,
the deathevent doesnot seem to trigger when I am setting the delay
so I was wondering in the runtasktimer if it is waiting will other deathevents still be triggerd?
can we see code
someone already did that
a lot of people*
doesn't mean they cant
why are my blocks spawning 1 more block than I want them to
I only added 1 to their position
What
"only added 1 to their position"
and it is spawning 1 block ahead?
idk what the confusion is about
I am not in a competition, I am doing for learning and fun
like one block too far
private static Location isempty(Location root, Player player) {
if (player.getWorld().getBlockAt(root.add(0,0,1)).isEmpty()) {
return root.add(0,0,1);
} else if (player.getWorld().getBlockAt(root.add(0,0,-1)).isEmpty()) {
return root.add(0,0,-1);
} else if (player.getWorld().getBlockAt(root.add(1,0,0)).isEmpty()) {
return root.add(1,0,0);
} else if (player.getWorld().getBlockAt(root.add(-1,0,0)).isEmpty()) {
return root.add(-1,0,0);
}
return null;
}```
im not
yes you are
Location newpos = isempty(deathblock.getLocation(), player);
if (newpos == null) {
newpos = deathblock.getLocation().add(0, 0, 1);
}
deathblock.setType(Material.CHEST);
player.getWorld().setType(newpos, Material.CHEST);
chest1 = (Chest) deathblock.getState();
chest2 = (Chest) player.getWorld().getBlockAt(newpos).getState();```
I'm not
okay if you say so 🤷♂️
bruh
those are the only 2 times
I used
add
besides another if statement
but that one adds it on the y axis
return root.add(-1,0,0); //adds -1 again to root location```
yes that is what i said
cool it worked thanks
Could someone good at java message me please, I have a problem with this project overriding methods (I need to send 2-3 screenshots which is why its best to DM)
send over a pm
should i split up my abstractcommand and my commandhandler?
i have now an immutable set of command instances in my abstract command which is not how it works
for readability sake, yes
smh is the ImmutableMap.of limited to an amount of keys and values
maybe i can use th builder
yo does anyone know how is the dependency called for https://github.com/Phoenix616/InventoryGui ?
this doesnt work
looks a bit weird 🎃
not that weird.
tho I think u can use normal hashmap
ugh and then in the constructor .put .put .put...
huh
probably idk
oki
why my command doesnt work? I registered it
and plugin.yml(ed)
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
if (command.getName().equalsIgnoreCase("punish") && sender.hasPermission("staff.punish") || sender.isOp() && sender instanceof Player) {
Player target = Bukkit.getPlayerExact(args[0]);
if (target == null) {
sender.sendMessage(CommonStrings.noPlayerFound);
}
else {
InventoryGui gui = new InventoryGui(FastGensBadcoder.getInstance(), ((Player) sender), "Punish", guiSetup);
gui.setFiller(new ItemStack(Material.GRAY_STAINED_GLASS, 1));
gui.show((Player) sender);
sender.sendMessage("?");
ItemStack item = new ItemStack(Material.BARRIER, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.RED + "Cancel");
gui.addElement(new StaticGuiElement('b', new ItemStack(Material.CYAN_STAINED_GLASS_PANE), click -> {
click.getEvent().setCancelled(true);
return true;
}));
gui.addElement(new StaticGuiElement('a', item, click -> {
if (click.getEvent().getWhoClicked().getName().equals("Barrier")) {
click.getEvent().getWhoClicked().sendMessage(ChatColor.RED + "Cancelled!");
}
return true;
}));
}
}
return false;
}
}
Is this command located in the main class?
Why do you need to check if the command that has been put is “punish”
If that’s not in the main class
my old plugin had like 120754 commands running on if (cmd.getname blah blah blah)
and they werent in main class
But you don’t need that
Since you when you register the command in the main class you do “getCommand(“punish”).setExecutor” ecc…
You already know that the command is “punish”
but like
just use a seperate class for each commands
does it change anything?
im doing that already
no what
it just simply easier for register command
btw if you do that then add in plugin.yml the command aliase would be easier than register
getCommand("punish1").setExecutor()
getCommand("punish2").setExecutor()
...
thats all i need?
getCommand("punish2").setExecutor()
this?
could it be cause im executing it on myself?
update: no
Hello can someone explain me why buildtools is mandatory for use nms ?
Why can't i use spigot repo online ? (i'm new at java development)
DMCA
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Imagine using buildtools
:sad:
Ah ok ! Thanks for precisions, now I understand why
hi im am very new to spigot coding!
what does @echo off means?
Did you notice without it
there would be a line that tell where the directory it is in
echo off just simply remove it
(if i remember right, dont judge me if im wrong...)
i want to give player certain permission when they run certain command
like if they type /wizard
player gets wizard.fly
perms
how do i do it
there is no .setpermission method
no method of adding permssion
try hooking with other permission pl
or try look at their source
to see how
Makes only output visible
how can I add an item to a full inventory?
I want to be able to add 60 to the stack of 4 grass blocks
I tried to do this by doing player.getInventory().addItem(itemstack); but it wouldn't add anything
Odd. addItem is supposed to fill and extend slots, including the first one.
And what would be visible otherwise?
hey there i need help with the multiverse plugin. i want to set the spawn from the sky_nether into the sky_overworld
same with the sky_end
#help-server ^^
ok ty
i want to give player certain permission when they run certain command
like if they type /wizard
player gets wizard.fly
perms
how do i do it
there is no .setpermission method
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (sender.hasPermission(""))) {
}
Give permission.
That is just check if player have perm
he wants like a setop bypass ,ok
Weirdguy101
Nope that just check perm, what they want is to give perm
i want to give permission to player
Easiest way is to use vault no?
how?
Vault.
I haven’t watched this but try this I guess:
https://m.youtube.com/watch?v=pTEZiAUrYJY
I’m not at my computer right now so I can’t check my code, been a minute since I added vault
Learn how Vault Economy API works in this video!
A great addition to your plugins, however, make sure you have Vault and an Economy plugin installed on your server!
https://www.spigotmc.org/resources/vault.34315/
Patreon:
https://www.patreon.com/codedred
Donate to me :)
https://www.paypal.me/CGMax
Join my discord:
https://discord.gg/zMzXSg...
@EventHandler
public void onPlayerAsync(AsyncPlayerChatEvent event) {
String msg = event.getMessage();
if (msg.equalsIgnoreCase(" ")) {
?
i've just seen that tasks have been updated and they now take a consumer, i have my custom runnable, what sgould i do?
i know it can be replaced by lambda
why does my console say /broadcast as unknown command
Cuz console no /
Only type the command
ye same thing
it says unknown command
Maybe try with no plugin instead?
broadcast is a Essentials plugin
[12:38:40] [Server thread/INFO]: Unknown command. Type "/help" for help.
there is no vanilla command?
👍
I think no maybe
Wiki on spigot has a list of commands
you can make one if wanted not hard ngl
ye k
Why do you even want to give a player permission just set no permission for the command
this is help development not help server
apparently my getInstance() is returning null somehow
if you mean that you have a custom runnable class, which implements Runnable, you should just change run() to accept(BukkitTask task). you wont have to change any code. example:
/** old Runnable class */
class TestTask implements Runnable {
public void run() {
System.out.println("Hello World!"); // you wont have to change anything
}
}
/** new Consumer<...> based class */
class NewTestTask implements Consumer<BukkitTask> {
public void accept(BukkitTask task) {
System.out.println("Hello World!"); // you wont have to change anything
}
}
is the constructor even called by bukkit?
i recommend changing it to this:
@Override
public void onLoad() {
millandDialogs = this;
}
@Override
public void onEnable() {
plugin.getCommand("dialogs").setExecutor(new DialogsCommandManager());
}
@Override
public void onDisable() {
millandDialogs = null;
}
i always do it like that
cool
maybe you need to do something before other plugins are enabled
there is nothing wrong about it
good to have it
it’s just not needed
meh
normally the only stuff that i need onLoad is starting some background processes or something like that
How can I add a comand with my code?
hi
i have json file with this elements
{
"EhsanMNA":
{
"Money": 10000,
"Tokens": 100,
"islandLevel": 10,
"isOnline": true,
"isBanned": false,
"name": "EhsanMNA",
"nickName": "&aMNA",
"lastPlayed": "1",
"lastJoinedDate": "1",
"ping": "25",
"skillsLevel": {
"hp": 10,
"mana": 10,
"level": 10
},
"BattlePass":
{
"Tier": 5,
"Exp": 100,
"IsPremium": true
}
}
}
```and ...
so i want to read this file with gson and write it
`i want to get this as an JsonObject` how can i do that ?
How can I add a command to the plugin.yml with code?
I had
anybody knows ?
That dont help
Why?
While this can be done it's not recommended
Prob creating a command with an command while in game
Which is an dumb enough Idea on ITS own
You probably want to be injecting directly in that case
Did you?
Also an option
Prob easier
Directly injekting into command map: 1) risky 2) I wouldn't know how to do it
There are?
Still not the way I would go
But whatever
Or I would listen for PlayerChatEvent
Cancel it
Do my own shit
Event is called before commands
what method do i call to get all players in the world
so that i can ban players that are offline
.getOfflinePlayer
this doesnt work tho
Why doesn’t it work
yes
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app')
So you’re trying to create commands right?
Yes
You really just never check the wiki.
plugin.getDescription().getCommands().put(command, options);
plugin.getDescription().save();
plugin.getCommand(command).setExecutor(executor);
Google your question before asking it:
https://www.google.com/
I want to make a API
Api?
You don't cast like that. Use getPlayer after checking if player is online
Now i prob will disappear as i have no idea about this thing.
i want to spawn a certain mob in every 12hrs real time how do i do it?
and how do i make a custom Trade GUI like Villagers or traders
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
I would suggest an inventory with an Consumer to executed the action linked to the slot
when i try to use this method (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.Spigot.html#broadcast(net.md_5.bungee.api.chat.BaseComponent)), i get this error: https://pastebin.com/iLWVGRRa
anyone know why?
is the method meant for the version youre using?
After defeating the ender dragon, the player receives a screen with a dialouge between to persons. Can I show that screen to a player, but with other text?
?kick @candid stirrup
Done. That felt good.
good
why wouldn't it be? i'm using the latest version of spigot for mc 1.17.1, and the javadocs i linked are for 1.17.1
Can pls anyone help me on this? Or show me a other method of making a sphere where i can change the radius?
you can show the screen with a packet but i dont think u can change it
Sad.
This would be so nice.
isnt the end screen a recourse pack
this is my first time coming to this server lmao
Ok, i have a problem related to java but has only happen to me in this plugin... i have an instance in the main class and a ArrayList as well...
but i can't access to the arraylist from another class
How are you trying to access it
Send code for the definition and accessing please
ok
public static MineSpaceSkills instance;
(OnEnable)
instance = this;
(OnDisable)
instance = null
}
public static MineSpaceSkills getInstance() {
return instance;
}```
that in the main class
and trying to access:
return MineSpaceSkills.getInstance().vanished
not missing nothing i think
pls
If MineSpaceSkills and whatever class you're using to access the array aren't in the same package that's not gonna work
Put public in front of it
oh
public ArrayList?
Yeah
ok. sorry 😄
Hi! I am coding a plugin in intellij IDEA, and i am doing my first plugin. But i need help, because when i try to generate the .jar file with Build > Build artifacts > build and it doesnt generate it. But it says this error in build output, i dont see anything in my code.
C:\Users\ondre\IdeaProjects\FirstPlugin\src\net\diamondlands\HelloWorld.java:8:30
java: cannot find symbol
symbol: class BlockPlaceEvent
location: class net.diamondlands.HelloWorld
My code:
package net.diamondlands;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class HelloWorld implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Material type = event.getBlock().gettype();
if (type == Material.TORCH) {
Player player = event.getPlayer();
player.sendMessage("Ahoj");
}
}
}
restart your ide if still doesnt say anything, validate caches and restart
and the problem is you didnt import BlockPlaceEvent, Material classes
and it is not gettype, its getType
@quaint mantle
resource pack
more info, search: resource pack how to change the end poem
thanks
Hey, i was learning about placeholder and have a question...
@Override
public String onPlaceholderRequest(Player player, @NotNull String params) {
if (player == null) {
return "";
}
if (params.equals("maxHealth")) {
AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
}
return null;
}
here
the placeholder
is %maxHealth%
or
%mainclass_maxHealth%
?
wiki for dev i think
but u didnt return tho
should return the string for the max health right?
no i mean you forgot to put the return String
wdym?
What does OfflinePlayer#getFirstPlayed() return?
And how do I turn it into a date?
oh okay
i got it
yeah
long firstPlayDate = player.getFirstPlayed();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(firstPlayDate);
int mYear = calendar.get(Calendar.YEAR);
int mMonth = calendar.get(Calendar.MONTH);
int mDay = calendar.get(Calendar.DAY_OF_MONTH);
i didnt test it though
i think we can just do
Date date = new Date(player.getFirstPlayed());
SimpleDateFormat lol = new SimpleDateFormat("HH:mm dd.MM.yyyy");
String firstPlayed = lol.format(date);```
Anyone able to help me with this?
how can I check a specific id (for example 260) and do 64 items, but for example do not do swords 64
short question: does somebody know how i can use PathfinderGoalFollowEntity exactly? Unfortunately, I have not found anything anywhere that explains exactly how I use this method. can somebody help me there?
Well firstly, don't
Use Material string names, Enootikin. Then you have the option of Material#getMaximumStackSize() (or whatever it's called, I forget)
thanks
PathfinderGoalFollowEntity(theEntityYouAddedTheGoalTo, speedModifier, stopDistance, areaSize)
stopDistance is the distance away from an entity it has to be before it stops pathfinding, and areaSize is... well, the size of the area the entity will start following entities
You can generally figure this out just by looking at source code and doing some reverse engineering, especially now that things are mapped more appropriately in 1.17 using Mojang's official mappings
I have a custom font in my resource pack, it works fine everywhere but books. my font is always black in books, is there a way to fix it
Okay. Where can i find the sourcecode?
So, I have an API and made a Test Plugin for it. But now I want to add commands, when my API Plugin is started. How can I add commands by code?
BuildTools generates "source" for you under the work folder
public List<Block> getNearbyBlocks(Location loc, int radius){
error: reference to Block is ambiguous
Import Block?
already imported
Anyone knows what that means? I am creating a heal command following a tutorial, and it says this.
import it?
Yo how can i code my plugin to be able to ban offline players
idk what method to call
so that i can ban an offline and an online player
change Command
that should be CommandSender sender, not Command sender
to CommandSender
where there exactly? When I click on the work folder there is no file with "Source".
public List<Block> getNearbyBlocks(Location loc, int radius){
error: reference to Block is ambiguous
No but there should be decompile<hash> folders
Open those and you'll see some source for NMS
Oh works now thx very much.
how can I register an event outside the onEnable() method
my full code: https://paste.gg/p/anonymous/505e7d817b724fdabb9749a608a5b0c1
error at public List<Block> getNearbyBlocks(Location loc, int radius){
Error: reference to Block is ambiguous
but onEnable() isn't class
thats method ahha
sorry lol
that is outdated ya know
but how can I do it
2013
Why do you want to register events not when the plugin is enabled?
no its after the plugin is enabled
my full code: https://paste.gg/p/anonymous/505e7d817b724fdabb9749a608a5b0c1
error at
public List<Block> getNearbyBlocks(Location loc, int radius){
Error: reference to Block is ambiguous
can you help?
So do it in onEnable()
but the listener class that I have the event in is made after the onEnable method is called
ok so im making a few minigames
and want each instance of the minigame class
to have its own private events
Bukkit.getPluginManager().registerEvents(listener, plugin)
oh yeah thank you
oh I might have realised by mistake
good you realised
wdym lol
how would i make a command like /gui edit where i can edit the gui and open that one with /gui?
i dont understand the question? Do you need to know how to use commands or make a GUI?
Like the command is easy
But how would i make the system where i can open the existing gui and edit it
and when i do an command it opens that editted gui
i have no idea sorry
i was going to try a GUI plugin after my minigame one but haven't yet
save items somewhere, and when you create a GUI just take the items from where you saved them
like HashMap<ItemStack, Integer> (item, slot)
etc.
java.io.IOException: Problem reading font data. ```java
Font.createFont(Font.TRUETYPE_FONT, fontStream).deriveFont(fontSize * new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor() / 2));
chest1 = (Chest) deathblock.getState();
chest2 = (Chest) player.getWorld().getBlockAt(newpos).getState();
Directional directional1 = (Directional) deathblock.getBlockData();
Directional directional2 = (Directional) player.getWorld().getBlockAt(newpos).getBlockData();
Bukkit.broadcastMessage(dir);
if (dir.equals("West")) {
directional1.setFacing(BlockFace.WEST);
directional2.setFacing(BlockFace.WEST);
} else {
directional1.setFacing(BlockFace.NORTH);
directional2.setFacing(BlockFace.NORTH);
}
deathblock.setBlockData(directional1);
player.getWorld().getBlockAt(newpos).setBlockData(directional2);``` why is this not broadcasting or changing anything
hola does anyone have a plug in to stop people from getting things with hacks like they can spawn a dimond sword with 100 sharpness
pls help
can't you just edit the values?
no hacks can spawn a sword yet
hola does anyone have a plug in to stop people from getting things with hacks like they can spawn a dimond sword with 100 sharpness
no hacks can spawn a sword yet
you can't "hack" in a 100 sharpness sword
then not a spigot issue
i'm not really into bedrock
go talk to geyser?
k
is bedrock mobile/win 10 minecraft?
i don't think there are plugins preventing that, i remember i used to download apps from play store to use hacks on minecraft pocket edition
so how does cube stop it
idrk
There are plugins that will remove illegal items
bump
hello, HandlerList.unregisterAll(); doesn't seem to be working for some reason,
1 sec let me elaborate
basically i have a Countdown class that handles a bukkitrunnable, it has an OnEntityDeath event, I would like to unregister it onCancel, and I used the method shown above, but it didn't seem to work. I've also added a if(task.isCancelled()) return; in the event but it still didn't seem to work. And yes, I am sure the problem is the event staying registered.
IllegalStack is a name I’ve heard a few times
Anyone knows how to add cooldown to a command?
hey Quick question: Is it possible with custommobs that burn in sunlight to turn off that they burn in sunlight?
public final class FontUtil {
private static final double BLOCK_SCALE = .025;
private FontUtil() {
}
public static double blockLength(String text) {
return MinecraftFont.Font.getWidth(text) * BLOCK_SCALE;
}
}
put a hat on them
cancel the entityCombustEvent or whatever maybe?
(^ not sure if that one exists)
a helmet stops burn in daylight
that doesn’t help at all…
I need a second pair of eyes to help advise the following:
I'm trying to add an event handler to detect when a certain plugin-specific event in plugin A is fired. When plugin A fires said event, plugin B needs handle that event. Now it seems that plugin B is not detecting that that event is fired. I set a breakpoint in that very first line for the event handler in plugin B. I also validated that the event is firing in plugin A. The class that handles the event in plugin B is being activated properly. Can anyone else suggest some common mistakes that I might be making? I'm losing my mind lol.
is there another way? or only via the helmet?
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.setOnFire(event.getDuration());
}
Could be missing @EventHandler, listener not being registered, hard to know without seeing code