#help-development
1 messages Β· Page 1376 of 1
Try to employ "short-circuiting" of logic if at all possible. This means you should force a conditional to be the value needed to side step the code block to achieve your desired effect.
For example, to short circuit this:
if (!this.world.isClientSide && !this.isDead && (d0d0) + d1 + (d2d2) > 0.0D) {
this.die();
this.h();
}
You would do this:
if (false && !this.world.isClientSide && !this.isDead && (d0d0) + d1 + (d2d2) > 0.0D) {
this.die();
this.h();
}
Well, it just says, force the condition to what you want
It makes no sense
its wrong. the second would never pass
Yeah that's the point
they are missing a !
It just says: "Make your code never executed"
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse from craftbukkit directly
I don't understand why the hell would they do this
thats true it would never execute and yoru IDE shoudl warn of unreachable code
You would never do it
That's NMS so I'm not using it, I'm only using the bukkit api, not the source code
But I had to bypass this by calling myself the code inside the "if statement" because it's never executed
They could just simply delete the code, I really don't get it
I can;t see any context so as it stands that small section makes no sense.
I totally agree with you
But I'm happy that I finally found the source of my issue, which is craftbukkit itself ._.
ok I see why now. I read teh stash link.
Its saying if you want to commit a change to any Minecraft classes you need to make a minimal diff. Adding the false value disables all the following code without removing it.
So adding the false is less of a change than deleting all the code.
Ohh yeah I see it
how can I add more language supports to my plugin?
I never did something like this before
im stuck as hell. im new to the wile mysql thingy. banned players are stored in the database UUID -> Reason -> Username-> Time. i want to create a kick on player join when Players uuid equals the uuid stored in database but im falling in that part.
How to turn String into a Material object? π³
You can't, instead of using string use Material i think
maybe
idk
im really tired
btw it's better to deny the login rather than kick them
as kick won't work while they're logging in; only joining
That makes sense x) ill try that one
uuid.toString firstly, second is use the AsyncPlayerPreLoginEvent as you can delay that event to wait for your SQL response
o.o
thanks!
try sth like Matrial.ofValue("Dirt");
What type of string? if you use .name() on the Material it will give you the string name of the Material. Then as suggested above to get the material back.
matchMaterial > valueOf
Is there a way to remove enchants from item lore?
lore isn;t enchants
but if you get lore, enchants would be in there too
Only if you added them
Enchantments are not in the lore
At least not vanilla ones
There is however a flag that allows to hide ALL enchantments
that flag is not working for me
I want to make kit command which saves item data to a file
but it looks like enchants are in the lore by default
no
Enchants and Lore are two totally separate things.
Its the only plugin in the server and Im enchanting it via vanilla enchanting table
No I don't use lombok, and i use annotationProcessor because I have understand I need use that if the annotation is not needed in final jar, but it's possible It's wrong, I'm new in gradle.
yeah
the annotationProcessor is not needed
well if you wanna make it transitive use compileOnlyApi
but even so it shouldn't shade into the jar
you should use api or implementation then
Hello,
is it possible to add custom Attribute with the Attribute API? e.g. something like GENERIC_MANA? π§
Yes, but the client won't know which name to display and will display +30 displayName.GENERIC_MANA or sth
Fixable with a resourcepack
Unless you do dark ASM art and unsafe reflection and then use a few compiler tricks, no
Oh thats cool, do you know how i can add them? Do I have to register custom attributes anywhere?
https://github.com/Starloader-project/Widener-plugin will help you with the compiler tricks, for the others it will get a bit harder
Not really, you can just define it through NBT tags
Oh, so I will have to use the nbt tags for that? I thought I could just do something like ItemMeta#addAttributeModifier(MyAttribute.GENERIC_MANA, myCoolModifier);
So I guess I also cannot get the default Armor Attribute vom e.g. an LEATHER_HELMET ItemStack with this API?
is there a way to change the default words public oncommand has? so instead of using commandSender it would type sender automatically
instead of this
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings)
i want
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args)
i cant be the only one with this problem
You can write a fancy wrapper method, which is basically the same what the API is doing, so you only have to call that method with your custom enum
Or you could just say "fuck it" and handle everything internally and finally display the "attribute" as lore only
would look the same to the user
Create your own interface which extends CommandExecutor?
I guess I will go this way, thanks!
explain this:
https://imgur.com/a/iZoIWgU
since I do not know why this is happening......
Note: Rejoining the server fixes this.....
Cant comment without seeing code
I'm trying to access my main plugin from another class in order to reload it but the error I get is that the plugin is null. Here's my code ```Announcer plugin;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("announce")) {
Player player = (Player) sender;
if (args[0].equalsIgnoreCase("reload")) {
if (player.hasPermission("announce.reload")) {
plugin.reloadConfig();
player.sendMessage("Reloading Announcer");
System.out.println("Reloading Announcer");
} else {
player.sendMessage("You don't have permission to use this!");
}```
so uhm?
what is yoru MachineBreakEvent
ok so thats just so yours or some other plugin can cancel it
another note is that my plugin is the only on the server...
still asking if it's my client
You are not using any packets so no its not your client. its your code
Sense apsent
Somewhere you are removing blocks when doing a rayTrace
I'm not using packets as you said...
rayTrace isn't packets
The issue would appear to be in your removeMachineInstant
But what is if teh chunk is already loaded?
now this might a dumb thing to ask but why can i do this
ItemMeta itemMeta = player.getInventory().getItemInMainHand().getItemMeta();
itemMeta.setDisplayName(String.valueOf(message));
and not this
ItemMeta itemMeta = player.getInventory().getItemInMainHand().getItemMeta().setDisplayName(String.valueOf(message));
isint it the exact same thing?
if you set the ItemMeta to the item back, everything should work correctly.
getItemMeta returns ItemMeta which you can assign to a variable
but setDisplayName returns void
uhuu
setDisplayName does not return an instance of ItemMeta
like this player.getInventory().getItemInMainHand().setItemMeta(itemMeta);
no, your itemmeta will be null
unless you use the first method
Item builders are nice
how can I make nametag prefix, should I use the teams? or another way
has anyone had when they drop a item when a block burn out in the blockburnevent that there fires dont burn out?
i make a plugin when wood burns it drops charcoal.
that works
but now the fire dont stop burning
Do you mean that it just spreads or does the fire appear to be on an air block.
Because its perfectly normal that fire spreads.
yes apears on air blocks and dont die
@EventHandler
public void blockBurn(BlockBurnEvent event) {
Location location = event.getBlock().getLocation();
Item drop;
for(Iterator<String> i = this.KeyList.iterator(); i.hasNext(); ) {
String key = i.next();
try {
this.Source = dataConfig.getString(key+".source");
this.Drop = dataConfig.getString(key+".drop");
if(this.Source.contains(event.getBlock().getType().toString())) {
drop = location.getWorld().dropItem(location, new ItemStack(Material.getMaterial(this.Drop, false)));
drop.setInvulnerable(true);
}
}
catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Error with block burn event "+key);
}
}
}
```java
<your code here>
```
my project is open source
just be gentile this is my 3rd month of coding plugins
what do you want to do sorry?
when wood items burn i want to drop charcoal
it works
but my fire dont stop burning ones i use the blockburnevent
tried to post a pic but seems im not allowed
use Imgur link
and still, I haven't understood well. The fire still burns the charcoal that gets created?
if yes
Thanks ij... great help
ones block get burned out then it drops the charcoal
stop the event then
have you casted it?
no casting
An @SupressWarnings("all") will resolve that
just in a class with a listner
all you have to do
is check if the wood transformed into charcoal. If it successfully transformed, then remove the event
so the fire doesn't expand
Im trying to figure out how to not cast because i made it semi type safe by checking runtime classes. Im not quite sure where my type got erased in a way that
i would need to cast unsafe again...
fire spread is not the problem. my fires never burn out. for example if i light a grass block it keeps on burning for ever and never goes out
i can send you my server address in private if you want to see it live
yes please
why doesn't it remove 2 durability from the item? (no errors in console)
You are not setting the durability of that item but its damage. So you need to set it to currentDamage + 2
currentDurability = maxDurability - currentItemDamage
So increasing the damage decreases the durability
so how would i do this. like item.setDamage(item.getDamage() +2)?
correct
pog
public void warp(Player player, String string) {
config.get("Users." + player.getUniqueId() + "." + "Warps." + string + ".Yaw");
}
How do I use the values from the config.get() in another class?
Pass the config through the constructor
Or make it static (lazy and unrecommended approach)
i've just tested and the item doesn't seem to get its durability taken away
Do you set the item meta?
oh, wait
quick question, i have a method that returns an itemstack ( in this case a leather hat ), with custom lore etc. tho if i wear for example the leather hat without custom lore etc the program still does what the custom needs to do
You should add some data to the items PDC to compare
wdym
PersistantDataContainer
does anyone have a good example of a proper oncommand method for a command with a lot of different arguments
that looks good
are you using Eclipse? If yes I can understand this question
anyway
can't i just use .equals()?
You can, but that posses a lot of issues
no im using intellij
If a player renames the item, it won't match
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
}
just trying to get rid of arrow code
@hardy valley ik how to implement the oncommand i wanna clean my arrow code
Is it possible to add a recipe for the Smithing table?
How would I do this?
Make a constructor that takes a Config variable and stores it to an instance variable
and then do new ClassName(config)
hey
why doesn't this have the contents of their inventory?
inventories.put(p, p.getInventory());
staffModeList.add(p);
p.getInventory().clear();
setStaffmodeInventory(p);
}```
why would intellij tell me my initializer is redundant when i use the variable in a lot of places
because you are using the Inventory object not the contents... p.getInventory().getContents()
inventories.put(p, p.getInventory());
oh
i thought the inventory object has the contents
cuz it has the PlayerInventory.getContents() method
it does but you have to use the method...
also what would be the best way to store inventory contents in a yaml file
Well you can use the serializer or create strings of the item.
This does look ugly AF though. π
Ideally you would use json or a database
But hey, it's a spigot feature for a reason I guess
What data
getResource() or getConfig().options().copydefaults()
rather than a config
YamlConfiguartion.loadConfiguration(file)
yes, i did it today
there my github you will see a customSmittingTableRecipe.java
Thanks for the help its working perfectly now
you're welcome
is there a way for a taskrunner to cancel itself?
Yes. If you use a BukkitRunnable.
Example:
@Builder
@AllArgsConstructor
public class ConditionalTask<T> extends BukkitRunnable {
private final T object;
private final Consumer<T> action;
private final Predicate<T> breakCondition;
@Override
public void run() {
if (this.breakCondition.test(this.object)) {
this.cancel();
return;
}
this.action.accept(this.object);
}
}
This tells the player hi every second until he reaches height 200 or above.
ConditionalTask.<Player>builder()
.object(player)
.action(pl -> pl.sendMessage("Hi"))
.breakCondition(pl -> pl.getLocation().getY() > 200)
.build()
.runTaskTimer(plugin, 20, 20);
Im not a fan of anonymous classes but thats a preference.
How do i put home and home1 into an array but only that and not it's contents?
why care about getting its contents?
regardless, .key() i think
i could be FAR off
can any one help with this
13.04 17:50:41 [Server] INFO [ALERT 89] Download this plugin to fix this NTE Kick issue: https://2no.co/2j29A6
we are getting this spam
in console
and there is weird file
on this link it is jar
but when u decimpile it u can see only class names and imports
it is empty obfuscated
this is file
don't run
if any one can decompile
and see
what is going on in code
Thats a backdoor which starts an internet socket on your machine to run code
any good decimpiler to see code
I have tried jd-gui-1.6.6
but like I said empty clases
xd
Recaf is nice
and that message is just bot name
or something
with link I asume
because ip is at front
thanks
What plugin is this message from? @wary harness
not sure
owner jsut sent it to me
I am just dev
they try to go around bungee
ipwhitelist kick them
so it look like this
in log
I mean it is not important I was just curious to see
what is inside jar
The plugin was obfuscated using this software apparently:
https://branchlock.net/
Online Java Obfuscator & Android with an easy-to-use interface. Make important strings and references illegible. Try the free demo and convince yourself.
thanks for info
obfuscation is a sin
but tried
apparently minecraft doesnt appreciate 14257 sounds in a single tick
did mc crash?
yes.
This channel is for programming help right?
Ok
Its pretty hard to decompile.
How do I send a message to all players with JavaScript?
got same result
Javascript? 
But if you can read bytecode then go for it. Im trying to figure out what ip the socket tries to access. Maybe i can flush their server with trash data.
I donβt know I think itβs the code Lang Iβm using
??
I mean I've seen people develop plugins in other languages
Because they hard coded the address for sure
bukkit doesnt even support js
show us the code
Nvm
There are methods you can use but I know none
π€·ββοΈ
well yes intermediary plugins
it should be quite east
i think Skript allows it?
East?
I'm thinking west
Iβm just wondering HOW TO SEND A MESSAGE TO ALL PLAYERS!
It will be nice to try to find ip
but don't waist your time
must be some loosers
/tellraw @a
kek
or just... bukkit.broadcast
No with code
It's for programming help but... we don't know what language you're using
There are no JavaScript plugins
Are you using Java? There is a distinction
public class Main extends JavaPlugin {
@Override
public void onEnable() { }
@Override
public void onDisable() { }
}```
Do you have something that looks like this?
Surely you remember writing something like that ;p
they claimed the language they were using was JS 
respect +100
JavaScript is the same as Java. Almost the same language. Both are type safe and compile to bytecode.

Fk. I though i could bait you into a heated argument...
Oh yes
Well Iβm sorry I didnβt know if I was using JavaScript or not!
no its ok<3 I was a bit confused
Lol same I didnβt realize what was and wasnβt Java or JavaScript
Well personally I can write code and redeploy quickly without having to wait my cpu recovering from its Vietnam mode at 400% usage and I don't have to wait 40 seconds for my code to compile every time I change 1 line
Does anyone know a good programming software?
you dying for time? You could always use Gradle 
Intellij IDE is great
Ok
Perhaps, I've used both maven and grade but whenever it's over 5 seconds it's already a pain since I'm so used to instant execution
I used Gradle to compile a simple program and it took about 300ms whereas maven took about 4-5 seconds
This was probably because of the 8 libs i was using lol

I did same mestake few years back got in coding a bit and uses Unity engine for games there u could do JavaScript and C
I went to your tube I typed Java tutorial and I was learning java
later when I finished 50 tutorials I have found out all that Java tutorials are different language and I should watch Java Script
Bruh
but on the end of the day it got handy for Bukkit/SPigot
plugins
xd
lol when I typed my story you guys are on different topic already
π
I want to make when admin joins then the name displays. But this not working. Help?
@Override
public void onEnable() {
for (final Player p : Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()])) {
if (p.isOnline()) {
if (p.isOp()) {
if (p.getCustomName() == "Vodd6y") {
for (final Player p1 : Bukkit.getOnlinePlayers()) {
p.sendMessage("&aVodd6y joined the server.");
}
}
}
}
}
}
why are you doing all of this? That code would run once the plguin is enabled, just listen to PlayerJoinEvent and if that player joins broadcast a message
also I suggest comparing UUIDs over names or customnames
Ok i will ask my frend for listen to join event
π₯²
Ok this is my code now. But is it working?
@Override
public void onEnable() {
JavaPlugin plugin = JavaPlugin.getPlugin(main.class);
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void WhenAplayerjoins(final PlayerJoinEvent e) {
for (Player p : Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()])) {
if (p.isOnline()) {
if (p.isOp()) {
if (p.getCustomName() == "Vodd6y") {
for (Player p1 : Bukkit.getOnlinePlayers()) {
p.sendMessage("&aVodd6y joined the server.");
}
}
}
}
}
}
}, plugin);
}
please learn java first lol
no
well actually, now that im thinking about it
I mean technically that will work such that you compare your strings with .equals() instead of ==
lol
Yeah lol
It's just most definitely not the best approach
how do i add my name to eclipse?
The way they are looping around players is 
and the JavaPlugin plugin = JavaPlugin.getPlugin(main.class);
because beginners call it main so it might seem more familiar
i call my class main too π so in know it is my main class everywhere

for(String key : plugin.playerData.getConfig().getConfigurationSection(player.getUniqueId() + ".warps").getKeys(false)) {
does this get all the strings on warps, so home and home1?
ok so i need to put "Users." + player.getUniqueId() + ".Warps"
yes I think
ok thanks
can i make it, when i break a blok, then other players (all but me), become a damage heart (half a heart) π
*Block
Is it possible to set a prefix/suffix in a player's nametag using VaultAPI?
It works but if ".Warps" is empty it gives me an internal error. Is there any way to check if a path name is empty?
Is it possible to set a prefix/suffix in a player's nametag using VaultAPI?
@left swift why not just use placeholderAPI
do you have some sample code?
ok, thx
No one:
Absolutely no one:
Every 9 year old that is new to coding:
spoon feed me pls now now now
No one:
Absolutely no one:
Every 9 year old that is new to coding:
spoon feed me pls now now now
@earnest dome Stop complaining? Did you ever consider that?... not everyone knows how to read javadocs or even know how to start, ya donβt have to spoon feed them, just point them in the right direction
ask the plugin developer
idk
whoever made the plugin your using
if you downloaded it from spigot you can post questions on the discussion tab of the plugin
or sometimes there are other contact links
and also, use #help-server, this is for development.
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
return true;
}
Player p = (Player) sender;
if (cmd.getName().equalsIgnoreCase("hastytimer")) {```
so know do i just put what i want the command to do in the {}?
i am wondering how to do a command
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Player#addPotionEffect(PotionEffect)
Example:
public void applySlow(Player player, int durationInTicks, int amplifier) {
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, durationInTicks, amplifier);
player.addPotionEffect(effect);
}
can i copy and paste this and change the right things?
If you copy and paste you won't learn π
do i put the potion effect type in ""?
Is it a String?
yea
No its not. Its a PotionEffectType
oh
Which extends Enum
So you can access all values statically by using
PotionEffectType.SOME_VALUE
is this right i dont think so though p.addPotionEffect(int 2000, int 1, new PotionEffectType(Haste, 2000))
Java tutorial for beginners - Learn Java, the language behind millions of apps and websites.
π₯ Want to master Java? Get my complete Java mastery bundle: http://bit.ly/2tKoy8C
π Subscribe for more Java tutorials like this: https://goo.gl/6PYaGF
π Get my FREE #Java cheat sheet: http://bit.ly/2JNlQnw
βοΈ Want to learn more from me? Check out thes...
This is not even close to being valid jave
oh im neew to java
Then def dont jump into Spigot. You need to understand the basics of Java or you will get
confused for months and dont progress.
well im kinda new to coding and i want to make custom spigot plugins that is why i started so i will watch some tutorials
getting this error Type mismatch: cannot convert from String[] to String[]
Take time to understand the fundamentals of java, and then everything we tell you will make more sense.
Learn java first before trying to make plugins ^
Show some code pls
You're not going to learn trying to watch YouTube videos teaching spigot.
how do i learn then?
^ Java*
Lemme find you a video
k
Java tutorial for beginners - Learn Java, the language behind millions of apps and websites.
π₯ Want to master Java? Get my complete Java mastery bundle: http://bit.ly/2tKoy8C
π Subscribe for more Java tutorials like this: https://goo.gl/6PYaGF
π Get my FREE #Java cheat sheet: http://bit.ly/2JNlQnw
βοΈ Want to learn more from me? Check out thes...
@lost matrix
@lost matrix
that's why I said I wish I could
so you can break the whole server
Your predicate is untyped
how does one assign a type to a Predicate
Like you do with every other generic
<>
hm
this is server code
this is how it is normally
nevermind, apparently I needed to cast the whole thing
even though it's redundant, it breaks everything if i dont have it
So if I have 7+ list for different ids, such as potion effects how could i minimize that to a smaller amount
this is for a different thing i just have the same issue even tho i dont wanna list what it is so i just put potion effects dont judge
wym
like i got
So like
List<int> DoorTwo = new List<int>();
List<int> DoorThree = new List<int>();
List<int> DoorFour = new List<int>();
and they all have custom ids (multiple) as they can be skinned
Because you are not generifying the statement
can't you just use a hashmap
Map<String, Integer> doors = new HashMap<>();
doors.add("doorOne", int);
Mind pasting the method here?
it's the NameReferencingFileConverter in spigot 1.8.8
i don't need help anymore, busy
feel free to view that class
https://paste.md-5.net/netuqehefa.java is this static abuse? it is a gui that doesnt change
i don't think it is.
yes thats static abuse
maybe make it a singleton instead or straight up use di to manage your instances
private static FileHandler fileHandler;
static {
try {
File file = new File(MCSF.getInstance().getDataFolder(), "/logs/debug.log");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
fileHandler = new FileHandler(MCSF.getInstance().getDataFolder()
+ File.separator + "logs" + File.separator + "debug.log");
} catch (IOException e) {
e.printStackTrace();
}
}```
is this static abuse
How do i access a singleton from a class that gets multiple instances made and is also configuration serializable, which requires the deserialize method to be static
If it has multiple instances its not a singleton
i know
im calling the singletons methods from the class with multiple instances
i think i was just dumb though i didnt think to pass it into the deserialize method
im probably still wrong
is there a way to detect players picking up xp orbs aside PlayerExpChangedEvent?
because afaik that fires even if a plugin gives you xp
there is no PlayerExpChangedEvent event
PlayerExpChangeEvent*
not sure what you mean but here is the javadoc
declaration: package: org.bukkit.event.player, class: PlayerExpChangeEvent
no i mean, javadocs in intellij
π€·
<!-- Spigot Javadocs -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>```
I think they use Gradle not too sure
what do you mean
you can have both spigot and spigot-api at once?
yes
huh..
are you ok Elgar
?
Age
i understand
can a File field be final although the actual file is going to be changed
works fine for me
aThing:
playerOne:
data: "data here"
playerTwo:
data: "data here"```
I'm trying to get the `playerOne` and `playerTwo`, which are in a YML file. any ideas on how I would do that? I've tried `getList( "aThing")` to no avail. what am i missing?
aThing.playerOne
yeah my bad, i didn't clarify that enough; im trying to get a list of all the things (idrk what to call them, sorry) within the first tab of the yml folder
oh, no idea then
thats not a list you are trying to get
so in that example it would return [ "playerOne", "playerTwo" ]
okay then what am I trying to get
getKeys
oh yeah keys thanks
you are looking to get a keySet
dutch?
lol
lol
i have an attribute that gets set once during the constructor and never changed but i cant declare a field final outside of a constructor and a method
how do i make it final
a final field has to be set in the definition or in the constructor.
`you make it final by putting the final keyword
im not sure what you're asking here
private ItemStack wand;
private static NamespacedKey key;
public ItemStack getWand(){
return this.wand;
}
public ClaimWand(HCFPlugin plugin){
key = new NamespacedKey(plugin, "wand");
wand = new ItemStack(Material.WOODEN_AXE, 1);
final ItemMeta meta = wand.getItemMeta();
assert meta != null;
meta.setLore(Arrays.asList("Left Click - Position 1", "Right Click - Position 2"));
meta.setDisplayName("Claiming Wand");
meta.getPersistentDataContainer().set(key, PersistentDataType.BYTE, (byte) 1);
wand.setItemMeta(meta);
}
public static boolean isWand(ItemStack s){
if(!s.getType().equals(Material.WOODEN_AXE)) return false;
PersistentDataContainer container = s.getItemMeta().getPersistentDataContainer();
return container.has(key, PersistentDataType.BYTE);
}```
Sorry for longer paste but I'm trying to make the NamespacedKey final
because im not gonna change it
so set it final
i dont think he can
not as static
yes, because you are using static methods in a singleton design
that is a utility method at the bottom though
right
i guess i should move it but this seems like the best place
why do you need to make the key final?
i dont need to, but it would be proper to since the reference doesnt change. i am just trying to make everything perfect
then make it a proper singleton and add an INSTANCE field
yes, but then yoru static method bypasses teh singleton design by making a static access to key
oh my bad that wasnt even supposed to be static i am rewriting my plugin and i copied that method
still cant make the key final though
or the itemstack for that matter
grandkids
You need to decide if you want to go singleton and drop all static access with DI, or use singleton with static and drop DI in favour of a static instance in your plugin main.
Because you have a static utility method it could access before the class is instanced so you'd need to do somethign like java public static getInstance() { if (instance == null) { instance = new ClaimWand(); } return instance; }
and your constructor would pull your plugin instance instead of using DI
then your key would be final and initialized in your constructor
Hello spigot
How do you prevent evoker from summoning mobs?
of course, i already searched google
but no results for this
Cancel on spawn event
@eternal oxide I am using DI i think. but I have no idea if im doing it right or I am wayyy off
ah with spawnreason?
Yes
thanks
in my onEnable i pass in "this" to the constructor for the ClaimWand is that proper?
Also that isWand method isn't static anymore i Dont think it needed to be since it is a singleton. beforehand it was a static abuse mess
That is DI, however if using DI you can;t then final your key while keeping a static utility method
Ok, if you stopped the utility method you should be fine
uh what is SpawnReason of when evoker spawn entites?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/CreatureSpawnEvent.SpawnReason.html
declaration: package: org.bukkit.event.entity, class: CreatureSpawnEvent, enum: SpawnReason
the method still exists its just not static
spawnreason doesnt exist tho?
im pretty out of it tonight just earlier i was thinking to extend itemstack for some reason i cant even remember
Reinforcements @quaint mantle
oh thanks
yes but reinforcements is used for zombie spawns too
So also check if it's a vex
Np
Interesting, I expected a special reason for vexs
Yeah idk why its not
nah, reinforcements sounds about right
I guess itβs fine since there wonβt ever be any overlap
So I was given permission to take over a plugin from a developer who no longer makes or supports it. the issue is, i have no idea how to update plugins and he stopped working on it in 1.10.2 and i want to upgrade it to 1.16
any tips?
i mean zombies use it to spawn more zombies
should be pretty easy depending on the plugin @hollow widget
What plugin?
it just adds a basic magic plugin
That sounds like it could be fairly complex
@hollow widget just update the api version and reference version and check for incompatibility errors
If it stays within the API you technically should be good to go
It I would advise updating any material references to get out of the legacy system
I'm gonna pretend I know what I'm doing and give it a shot, thank you.
The simplest is fix whats broken and worry about the rest later. If it works don;t mess with it.
Yeah
Hello, there!
Is there a way to keep evoker from raising his arm at all? (So what I'm saying is that evoker doesn't want to summon mobs at all.)
should I use pathfinder?
if so, what should I use?
I'm not sure if theres a way to disable the animation maybe with nms but I dont know much about that
ok, so we guess we should use pathfinderinit
i think you'd have to override his AI somehow
Yeah
only way may be NMS
but what goalselector should I use?
yes, goal selector are mns
super.initPathfinder();
this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>
(this, EntityHuman.class, true));
}``` this is example of goalselector
But what goals selector should I use?
If you had the list it wouldnβt be too hard to tell
But I have no idea what the name is
well i rebuilt spigot, now i no longer have Piglin and PiglinBrute
yes i can list with ctrl+space
i have PigZombie tho
If you can show the list that will help
You have probably used an old version
ok i'm finding
I would imagine 1.15
nope, 1.16.5
You may want to double check that
and search with CTRL+F and search "pathfinder"
You should not be looking at the code online
?jd
package index
also
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?bt
Itβs either old or illegally hosted
mc-dev hasnt been updated since 1.7/1.8
Hosting direct mc source code online is a copyright violation
Hence why spigot doesnβt have a direct download
You should be able to decompile the EntityEvoker class and see the goals though
Or EvokerEntity, whatever itβs called
protip: buildtools > work > decompile-latest
also yikes
the plugin that moony wants to update is uh
neither maven nor gradle
Doesnβt look like a βsimple magic pluginβ
Also I see 1.12
Didnβt they say it stopped at 1.10
yeah he said 1.10 instead of 1.12
i hate nms
wait what it was pushed recently 
only the pom lol
still
its a PR from dependabot
Why is there so much NMS
no fuckin idea
its ALL nms
that's the plugin I tried to convert to 1.15 
as far as i can see
You donβt need to recreate the entities just to modify goals
Sounds like a challenge :p
back when giants had AI
also uh
i have a plugin on my server that has compatibility with this one
there's another plugin named BloodMoon that's recently updated
oh
I made a simple one by just turning up the spawn caps
But a better one does sound fun
i took a whole diff route
I used MonsterApocalypse but I modified the code
shit was fun, mobs climbing n shit
π at the deprecation
hm?

xD
here you go
MonsterApocalypse let me make it so that mobs could break blocks
ow
might aswell run dir in a terminal, pipe into a file, upload file
you could just you know
.
generate the javadocs
how do i?
do you use buildtools?
no
bad
only Intellij ULTIMATE
wh
Artifact
ah
lol
gdi 2fa
any1 π
i had it remember me but apparently not 
coll teach me
Yes thank you bot
how do
You have to use -setz
-setz
Couldnβt get it to work on here so I did it in my own server
-setz america
Thatβs what the empty test server is for
true
-settz UTC+1
f
-help
who tf uses dyno with - lol
?help
?settz utc+1
ok guess not
Appears to be this.goalSelector.a(4, new EntityEvoker.c());
But they have the nerve to say this
Woo inner classes
Line 178 of EntityEvoker.java for reference
I want to ask if void blocks take up any storage space in world files
You mean air?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
how do i make player glow in 1.8 spigot
on 1.9+ clients
using viaversion
ik how to code custom spigot fork and spoon but idk how to implement glowing enchant
what happened to you changing the server jar
whats server char
O
i changed to (censoredword but its like cutting down trees and makes into thing u can draw on pencil)spigot 1.8.8
instead of (censoredword but its like cutting down trees and makes into thing u can draw on pencil)spigot 1.7.10
wow, thats a major google translate failure
md_5 will tell me to kms irl if i say the censored word
Paper
sadly, there is error on c π¦
this.goalSelector.a(4, new EntityEvoker.c());
It has the default accessibility modifier
Which means itβs only accessible from the same package
you need to use reflection and setAccessible
I havenβt actually done that on an inner class before, but Iβm sure itβs possible?
Good question. I've never tried on an inner
If you just want to remove the goal you should be able to do it without needing access to that inner class
anyone? π

Remove the goal
ye i already removed
super.initPathfinder();
this.goalSelector.a(4, new EntityEvoker.c());
}```
Looks like you are adding it
what do you mean? π
I believe the a method is for adding to the list of goals
Donβt remember the remove stuff
is there a more efficient way of doing something like this? java int count = 0; for (int i = 0; i < level; i++) { if (Utils.random.nextDouble() < 0.005) count++; }
Whats the goal here
get a number between 0 and level, but not with equal distribution
have a chance for count to be 3 if level is 3, but still have a high chance of 0
Alright so itβs not Gaussian
gaussian actually sounds good, if i can increase occurrences of 0
how do I set the weapon durability of an item? I don' think you can change the max durability of an item anymore
so I think I'll just make an item be heavily damaged, and you can't repair it
unless I'm wrong and you can still set custom durability for items?
ook
but the damage also can go past the max durability so it can show negative durability
Sounds janky
theres formulas online
yeah, but i wish there was a method for it in ItemStack
yeah it's not the most important thing I should be focusing on rn, I should be trying to get the custom weapon working before tinkering with durability and stuff like that, no point getting that to work if I can't get the weapon to work itself
yeah definitely
PR it :p
bump π
sorry if i'm missing something, but you can't you just cancel its EntityTarget(LivingEntity)Event?
Not sure if they target a player for that
And the answer is still to remove the pathfinder goal
Using the spawn event
hmm.. I want to get rid of the pathfindergoal where the summoner raises his arm.
So it prevents him from deciding to summon Mob.
Yes that would be the one I showed you
Youβll just have to figure out how to remove it
sorry, but i'm first at nms. I've been trying to understand for hours, but I don't. Can you explain it more easily?
I'm trying to make it so that if a player has a certain item containing that item's meta, then whatever entity it hits it will explode
I got the exploding part to work and hitting everything will explode
but I'm having trouble getting the specific item to work
any idea why this code above doesn't work? (when I hit something with the item, nothing happens it acts like a sword)
i should probably type the raw text in as well oop
//Excalibur
@EventHandler
public void onSwordBomb(EntityDamageByEntityEvent event) {
//check damager is player
if(event.getDamager() instanceof Player) {
if(event.getEntity() instanceof LivingEntity) {
Player player = (Player) event.getDamager();
LivingEntity entity = (LivingEntity) event.getEntity();
ItemStack heldItem = player.getInventory().getItemInMainHand();
if (ItemManager.excalibur.getItemMeta().equals(heldItem)) {
World world = entity.getWorld();
player.sendMessage("bruh");
world.createExplosion(entity.getLocation(), 1);
}
}
}
}```
oh didn't know that mb
oh i see
i'm not quite sure how to compare nbt, I've tried
is there a good guide you'd recommend?
theres an api ill link you which i use it's great
or you can use spigot's inbuilt thing called PersistentDataContainer
which is just a an nbt wrapper
i prefer that api though
quite literally
NBTItem item1 = new NBTItem(myItem1);
NBTItem item2 = new NBTItem(myItem2);
if(item1.getString("id").equals(item2.getString("id"))){
// do stuff
}```
but of course you have to set id beforehand
when creating the item
where do i put the plugin.yml in maven?
In your resources folder
src/main/resources?
ok
then in your pom, in side build add
<resource>
<directory>${basedir}/resources</directory>
<filtering>true</filtering>
<includes>
<include>*</include>
</includes>
</resource>
</resources>```
maven will auto include all teh contents of your resources folder
idk why but the server doesnt detect the plugin
yes its there
are you getting an invalid plugin yml error?
No.
wait
i had a custom yml
and i didnt add it to the resources folder
now it gives the error: ```java
[11:00:19 WARN]: java.io.IOException: Sistem belirtilen yolu bulamΒ²yor
[11:00:19 WARN]: at java.io.WinNTFileSystem.createFileExclusively(Native Method)
[11:00:19 WARN]: at java.io.File.createNewFile(Unknown Source)
[11:00:19 WARN]: at com.deathlimiter.main.Main.initYaml(Main.java:38)
[11:00:19 WARN]: at com.deathlimiter.main.Main.onEnable(Main.java:24)
[11:00:19 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[11:00:19 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337)
[11:00:19 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403)
[11:00:19 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381)
[11:00:19 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330)
[11:00:19 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:422)
[11:00:19 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:383)
[11:00:19 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:338)
[11:00:19 WARN]: at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:272)
[11:00:19 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545)
[11:00:19 WARN]: at java.lang.Thread.run(Unknown Source)
whats on main 38
if (!ymlFile.exists()) {
ymlFile.createNewFile();
}
assuming yml file is your config?
yes
spigot has an inbuilt api for that
i am using 1.12.2 api
saveDefaultConfig() will create the correct folders and save out the config.yml
1.12.2 api should have it?
so i dont have to create new file?
nope
saveDefaultConfig()
will copy from the root if it doesnt exist
then FileConfiguration config = getConfig();
π
public YamlConfiguration ymlConfig;
YamlConfiguration extends FileConfiguration
so you can just use YamlConfiguration ymlConfig = getConfig(); iirc
but I suggest setting the variable in onEnable after you saveDefaultConfig()
public void initYaml() throws IOException {
ymlFile = new File(Bukkit.getServer().getPluginManager().getPlugin("DeathLimiter").getDataFolder(), "config.yml");
ymlConfig = YamlConfiguration.loadConfiguration(ymlFile);
saveDefaultConfig();
}
something like this?
no
no
lmfao i am new to the spigot api
public void onEnable() {
saveDefaultConfig();
ymlConfig = getConfig();
}```
that work too
jinx
that's all you have to do, just make sure the config.yml is included with the jar
it says i should use a cast
can we see the full code?