#help-development
1 messages · Page 1429 of 1
yes
god this bot sucks ass
then its impossible for that code to return an empty list
when i for each it and print it prints every index
;-;
but when i set a variable to it
its empty
wat
^
its true
that is the code
Your Engrish very broken
what
the entire code
cant
the part where it's not empty
?paste
what?
i swear this guy is a troll
you said the list is not empty when you iterate over it
im not a troll
post code or we are done helping.
but it becomes empty when you assign it
didn't he mess you around for like an hour the other day nny?
yes
getConfig().getStringList("test").foreach(System.out::println); <-- i think when i did this it printed every index
and how are you checking that
for some reason
List<String> test = getConfig().getStringList("test");doesnt work
is empty
show
I'm still waiting to see some code
String test = test.get(i);
player.sendMessage(test);
}```
the only reason why im doing it this way is cuz im adding more lists in a sec
and where is this in relation to
getConfig().getStringList("test").foreach(System.out::println);<-- i think when i did this it printed every index
wdym
show the class that contains these two statements
?
are you retarded
getStringList works perfectly fine. The issue is in YOUR code, so either show us the code you are using that is not working or stop asking.
i showed the code
¯_(ツ)_/¯
as expected of a 1.12 user
i want you to do what I tell you to do
i gave u the code
Show us the ACTUAL code, not some 2 line snippet
and this ^^
yeah but that snippet is the code that isnt working
why u need the whole code for
that doesnt make sense
Bye. Good luck with your super secret code that no one can see.
bro do you want help or not like wtf
👋🏿
^^^
k give me a sec
🤣
heres the code
im here cuz was referred from #general
jus came 2 say @acoustic estuary sho code but u jus did so 👏 congraterlations u finaly did it frend 😄
@granite stirrup i meant lol oops rong guy
lol
now show the relevant config
this is completely different from what you showed earlier
permissions:
crates:
help: ""
reload: "mooncrates.crates.reload"
test: "mooncrates.crates.test"
resetconfig: "mooncrates.crates.resetconfig"
gui: "mooncrates.crates.gui"
# messages
permission_message: "&cYou dont have permission to execute this command!"
# help menu
help_title: "&c>> &3-- Crates Help Menu"
help_prefix: "&c>> "
help_end: " &3-- "
help_commands_names:
- "crates.help"
- "crates.test"
- "crates.reload"
- "crates.resetconfig"
- "crates.gui"
help_commands:
- "/crates help"
- "/crates test"
- "/crates reload [<config>]"
- "/crates resetconfig"
- "/crates gui"
help_commands_description_crates.help: "shows this helpful menu"
help_commands_description_crates.test: "basic test command"
help_commands_description_crates.reload: "reloads the plugin and or just config"
help_commands_description_crates.resetconfig: "resets the config"
help_commands_description_crates.gui: "gui for crates"```
there
ok permissions is not a stringLIst
?paste
it is?
is it not
no papi
you are throwing an IndexOutOf bounds because you are trying to pull from an empty permissions list
lol
permissions:
crates:
help: ""
reload: "mooncrates.crates.reload"
test: "mooncrates.crates.test"
resetconfig: "mooncrates.crates.resetconfig"
gui: "mooncrates.crates.gui"
a dictionary with i key in it
well i need it like that lol
then don;t attempt to read it as a list
package me.barry;
import me.barry.commands.Equipcommand;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
Equipcommand commands = new Equipcommand();
getServer().getPluginManager().registerEvents(new Equipcommand(), this);
this.getServer().getConsoleSender().sendMessage("[PLUGINX] Loaded with hash: x4dw");
getCommand("equip").setExecutor(commands);
}
@Override
public void onDisable() {
getServer().getConsoleSender().sendMessage("Plugin XYZ Disabled");
}
}
I've fucked up something here, i've got a commands class, if you want me to send it too please say.
Whenever i use the command nothing happens /:
well how do i get a dictionary then
how do i get a dictionary then
dictionary = Map
you want to redesign this whole thing
is it in ur plugin.yml?
yup
You do realise you can dump ALL this code and just use the plugin.yml correctly
no i dont
basically git gud scrub
sho plugin.yml & commandclass
why does it error Map<?, ?> permissions = getConfig().getMapList("permissions");
its NOT a LIST
<?,?>
and that is still NOT A LIST
ight 2 sec
oh
for your permissions you can getConfig()#getConfigurationSection("permissions").getKeys(false);
so then its this List<Map<?, ?>> permissions = getConfig().getMapList("permissions");
IT IS NOT A LIST
setup your plugin.yml properly and you don;t need any of this code. Spigot does all this for you
then wat is maplist for
for a list of maps
Command
package me.barry.commands;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class Equipcommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("§7[ §cEQUIP §7] §fThis plugin's command, is only usable by a player!");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("equip")) {
Inventory inv = player.getInventory();
inv.clear();
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD, 1));
player.getInventory().setItem(1, new ItemStack(Material.FISHING_ROD, 1));
player.getInventory().setItem(2, new ItemStack(Material.BOW, 1));
player.getInventory().setItem(8, new ItemStack(Material.ARROW, 32));
player.sendMessage("§7[ §c§lEQUIP §7] Plug has been enabled.");
return true;
}
return true;
}
}
plugin.yml
main: me.barry.Main
name: thePlugin
version: 1.0
description: Best plugin?
api-version: 1.8
author: barry
commands:
equip:
description: best cmd
it handles command syntax/help and permissions
listOfMaps:
- map1key1: value
map1key2: value2
- map2key1: value3
- map3key1: value4
this is a map list
looks rite 2 me... try adding a debug messge at top of onCommand() methed
n see if it runs
for(String perm : getConfig().getConfigurationSection("permissions").getKeys(false)){ // do stuff
}```
You are looking for config.get("path").getValues(true);
What's the proper way to send a message to console
depends on your defintion of sending a message
do you mean to log a message?
like "plugin x enabled"
use the Logger available to you by your plugin's getLogger()
so many "doesn't work" 😦
men
this.getLogger()?
getServer().getConsoleSender().sendMessage()
yes
i got it to work but it only gets one of the values ;-;
plugin.getLogger().log(Level.INFO, "BOO");
getLogger().info("message")
doesnt work gives me error in ide
oh no, an error. I'll fix that right up for you. Let me get out my crystal ball...
it aint logging anything
replace get with getConfigurationSection
what
your onenable is probably not getting called
At what point are you attempting to log something?
yeah you dont say so xd
which means that your plugin is probably exploding before it can enable
send the logs or something
public class Main extends JavaPlugin {
@Override
public void onEnable() {
Equipcommand commands = new Equipcommand();
getLogger().info("hash: wextpm23");
getServer().getConsoleSender().sendMessage("[PLUGINX] Loaded with hash: x4dw");
getServer().getPluginCommand("equip").setExecutor(new Equipcommand(this));
}
@Override
public void onDisable() {
getServer().getConsoleSender().sendMessage("Plugin XYZ Disabled");
}
}
?paste latest.log from the server
it's probably exploding on new Equipcommand
post the log
it will be in the log, blowing up on either no plugin.yml or NPE on the command.
use some pastesite
Could not load 'plugins\cmd.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
main: me.barry.Main
name: thePlugin
version: 1.0
description: Best plugin?
api-version: 1.8
author: barry
commands:
equip:
description: best cmd
[19:25:37] [Server thread/ERROR]: Could not load 'plugins\cmd.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
What's wrong in there /:
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
reading the error helps
Yep, no plugin.yml in your jar
dafuq
using maven or exporting?
what folder is yoru plugin.yml in in your project?
same folder as Main
if you are Using Artifacts you are not using maven correctly
so i did it but for some reason it doesnt work at all now
put it in resources
bruh moment
Lets go right back to the very beginning. What exactly are you trying to do? as it seems you are attempting to add permissions to commands.
nah im trying to make a help show to the user
for all my commands and stuff
in target/
then setup your plugin.yml commands correctly and read straight from there. plugin.getDescription()
no
no?
cuz im not using the plugin.yml for commands lol
all the information you are adding to a config shoudl already be in your plugin.yml
well its not a jar file
im using the commandmap lol
its more all the classes and as folders
well don't
why
because you don't need to
i want to
reinventing the wheel
you shouldn't
why not
because you obviously have no clue how
and are sitting here wanting us to handhold you to do it properly
well seems i didnt get the jar file sad
you don't need to use the commandmap to make a help menu
the wrong way of doing it, and you basically want us to write it for you
if you didn't use the commandmap, making the help menu would be 50x easier
im not using the commandmap for the help menu???
but i dont want to have to keep adding shit to the plugin.yml file
i want it to be simple
how is it different from having to add shit to the config.yml file
¯_(ツ)_/¯
i just want to do it this way lol
you can access every command, its permission and its usage.
i dont want to tho
We are not writing it for you
im not saying that
you should learn how to use the commandmap and register commands programmaticly
you are not doing it properly right now
You are just askign us every step of how to do it your way.
which is why you are having issues with it
bro im not asking u to do everything
aha it work
i just need to get a dictionary from the config
no you don't
i do
you need to figure out what you are doing
no
currently you are flailing about aimlessly
What is your reason for not wanting to do it the proper way?
If you have a good valid reason for using teh command map.
idk i just dont like having to go in and out of the plugin.yml file
or is it "I want you to show me how to make a wheel, but it has to be square".
so you go in and out of the config.yml file instead
You are not saving steps. You are just adding a whole heap of code and tests to replicate what is already done for you.
If you are going to go the non-plugin.yml route, use a command framework
you can also try writing a command framework yourself
but you should do it properly
lol, he's refusing the use the Spigot API you think he'll use a framework API 🙂
¯_(ツ)_/¯
🥲
it been liek dis all week xD
Why errors after this?
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (byte)3);
SkullMeta headMeta = (SkullMeta)head.getItemMeta();
headMeta.setOwner(player.getName());
headMeta.setDisplayName(player.getName());
headMeta.getLore().add("§fplayer");
head.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 99);
head.setItemMeta(headMeta);
Inventory inv = player.getInventory();
inv.clear();
player.getInventory().setItem(3, head);
An internal error occured while attempting to perform this command
logs:
Caused by: java.lang.NullPointerException
at me.barry.commands.Equipcommand.onCommand(Equipcommand.java:29) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched.jar:git-PaperSpigot-"4c7641d"]
... 15 more
what is line 29?
headMeta.getLore().add("§fplayer");```
ok so setLore
Arrays.asList
nobody wants to use ChatColor.reallyfuckinglongconstantname
can i do it like i send
that isnt components?
or ChatColor.of(myhexcolor)
or that
real men use §'s
Can you use it like this?
headMeta.setLore("§f" + player.getName());
because real men know what each of the codes means and can visualize it easily
isnt it the same fucking thing as &
yees
except the other one cant be used in minecraft chat lol
headMeta.setLore(Collections.singletonList("§f" + player.getName()));
intellij made me make it into that
idk
the difference between & and § here is that & would mean you'd have to use the ChatColor translateAlternateColorCodes method
or whatever it was called
stupidly long anyway
but § is susceptible to encoding issues
only if you read it from a file
I've seen issues with it in certain plugins, though never if it is specified as it's codepoint name
you can control the encoding of your own classes so there shouldn't be any issue there
well, assuming some level of competence, anyway
which i suppose is a pretty long shot when it comes to most developers
if (event.getAction() == Action.RIGHT_CLICK_AIR || Action.RIGHT_CLICK_BLOCK)
bad operand types for binary operator '||'
first type: boolean
second type: org.bukkit.event.block.Action
how is first one a boolean
== makes it a boolean
no...
(:
read the error again
bad operand types for binary operator ||
binary operator is an operator that takes two operands
in this case, the left operand is event.getAction() == Action.RIGHT_CLICK_AIR
your code after the || does not evaluate to a boolean
which resolves to a boolean, because of ==
and like it says, the first type is boolean
however, the second type is Action
it wants a boolean
you must convert this Action into a boolean somehow
oh ok
for example by comparing it with something by using ==
i found way
package me.barry.listeners;
import org.bukkit.Material;
import org.bukkit.Sound;
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.inventory.ClickType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class RightClickListener implements Listener {
@EventHandler
public void headsConsume(PlayerInteractEvent event) {
Player player = event.getPlayer();
player.sendMessage("This first part works!");
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
player.sendMessage("This second part works!");
if (player.getItemInHand().equals(new ItemStack(Material.SKULL_ITEM))){
player.sendMessage("This 3rd part works!");
player.setItemInHand(new ItemStack(Material.AIR));
player.playSound(player.getLocation(), Sound.EAT, 10, 29);
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 30, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 30, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 15, 3));
player.sendTitle("§6§lGOLDEN HEAD", null);
return;
}
return;
}
}
}
It doesn't even send the first message?
did you register it
Bukkit.getPluginManager().registerEvents
Bukkit.getPluginManager().registerEvents(new RightClickListener, this);
@fiery inlet
not quite but closer
you also need the plugin parameter
and () for the constructor
if (player.getItemInHand().equals(new ItemStack(Material.SKULL_ITEM))){
This wont work
what will work then
what are you talking about
player.sendMessage("This first part works!");
It doesn't even send the first message?
i was being sarcastic
if(player.getItemInHand().getType().equals(Material.SKULL_ITEM))
use == when comparing enum constants
nuggets matter
true, but Item#getType is nonnll anyways
though null safety with constants is dumb to begin with since enum types should never be null
point is that it indicates your intent better
well

and is generally just the convention
it reaches 2nd part
3rd part no go
if (player.getItemInHand().getType().equals(new ItemStack(Material.SKULL_ITEM))){
ye so do what I said
if (player.getItemInHand().getType() == Material.SKULL_ITEM)
not new ItemStack(Material.SKULL_ITEM) just Material.SKULL_ITEM
yes i notice
also shouldn't you be using getItemMainHand rather than getItemInHand
i need to restart server and shit
or are you writing for 1.8
1.8
of course you are
getItemInHand is prefered, atleast imo cuz it maps to getItemInMainHand so its 1.8-1.16 compatable
using deprecated methods is not preferred
yet, it only applies the potions for 2 seconds
if (player.getItemInHand().getType().equals(Material.SKULL_ITEM)){
player.sendMessage("This 3rd part works!");
player.setItemInHand(new ItemStack(Material.AIR));
player.playSound(player.getLocation(), Sound.EAT, 10, 29);
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 30, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 30, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 15, 3));
player.sendTitle("§6§lGOLDEN HEAD", null);
return;
}
and he uses equals rather than ==
if you want 1.8- 1.16 support then its prefered, if you dont then use whatever u want
smh
^ it litrally doesnt matter
it literally does matter
It litrally doesnt
public final boolean equals(Object other) {
return this == other;
}
They litrally do the same thing
yes, but that doesn't mean that it doesn't matter
and that is not even literally the same thing
it is tho
it's not
Definitely not the same
because I don't like it when people teach noobs bad habits
i got that
right but ItemStack#getType isnt null so it really doesnt matter
by saying "i got that" i meant stop arguing, i got it
that it isn't null isn't relevant
Hello, do you know why he doesn't want to weld slime on me? I use packetwrapper. My code:
//slime
WrapperPlayServerSpawnEntityLiving slimePacket = new WrapperPlayServerSpawnEntityLiving();
slimePacket.setUniqueId(UUID.randomUUID());
slimePacket.setEntityID(slimeId);
slimePacket.setType(EntityType.SLIME);
slimePacket.setX(loc.getX());
slimePacket.setY(loc.getY());
slimePacket.setZ(loc.getZ());
slimePacket.sendPacket(p);
WrappedDataWatcher.WrappedDataWatcherObject slimeObject = new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
WrappedDataWatcher.WrappedDataWatcherObject slimeObject2 = new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Integer.class));
WrappedDataWatcher.WrappedDataWatcherObject slimeObject3 = new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class));
WrapperPlayServerEntityMetadata slimeMetadata = new WrapperPlayServerEntityMetadata();
slimeMetadata.setEntityID(slimeId);
WrappedDataWatcher slimeWatcher = new WrappedDataWatcher(slimeMetadata.getMetadata());
slimeWatcher.setObject(slimeObject, (byte)0x20);
slimeWatcher.setObject(slimeObject3, (byte)0x01);
slimeWatcher.setObject(slimeObject2, 1);
slimeMetadata.setMetadata(slimeWatcher.getWatchableObjects());
slimeMetadata.sendPacket(p);```
excuse me this is the internet, im allowed to argue with complete strangers about dumb stuff
lol
uh
didn't I link you an API that does what you're trying to do
like a week ago
fair enough ❤️
oh nvm i was just hungry ingame and add that with speed it looked weird
i tried to use it on 1.16 but had some errors when I enable server
can you paste one of those errors
it might need to be updated for 1.16
since it's open source that should be pretty easy
it doesn't seem to directly depend on nms though so it should probably work out of the box on 1.16
Since you all in here experts, any of you all got a good video on port forwarding and making your server public for some friends to test?
was it this?
IllegalStateException("Failed to start MultiLineAPI! PacketEntityAPI could not be found!");
yeah this resource is kind of dumb apparently
it says it's an api but it's a plugin
Hello, simple question cus lazy to test it, does World#getLoadedChunks() also includes force loaded ones?
thx
Where I can find method place block by player in open source spigot?
Explain better as I tried to help you earlier but you started on about Worldguard not working with cancelled events or something.
worldguard no work cancel event omg
a yea how you cancel event other plugin can have problem with cancel and logblock (can don't register place block)
then you need to cancel at teh correct priority
The code I gave you simulated an actual player placement so it would be detected by logblock and worldguard
Does anyone know what priority worldguard useds
previously i tried to do that canceling events but there were errors
I'd rather spigot change it
before I change in open source spigot and I build this
some things are easiest to change with a spigot
oh ElgarL I ended up figuring it out yesterday, thanks for the help
run this class and see how it works. you can then implement your own version of block placing. https://paste.md-5.net/erowipipiy.java
Thats a standalone class, just register events for it
pluginManager.registerEvents(new Target(instance), instance);
also just a random question, I don't think it's the case but is there a way to identify blocks that will break or get modified by the absence of a supporting block such as ladders or lanterns?
yes
you'd have to hook into nms afaik
without nms
i don't remember there being a reliable api method for telling whether a block relies on other blocks and in what way
i super vaguely maybe remember something about like a method on Material or some shit that might do something similar but if it existed it wasn't reliable
there is an event, I forget the name though. It covers things like torches popping off
block destroyed event i think
some to think of it
i should look into how that's done in nms
right now i'm just manually compiling sets of blocks that depend on certain blockfaces
which is mega cancer
I guess the question is would it be more reliable / efficient to scan blocks getting broken and try to correlate that to the specific explosions I am getting or would it be better to scan adjacent blocks for co-dependent blocks
what're you trying to do again
right now I'm just trying to make a decently accurate explosion regenerator
but you know, ladders and shit
there was some hacky way of getting all of the blocks that were destroyed as an indirect result of a block being destroyed
man in a very real sense it would be much easier for me to just write my own explosion system
hm
or was that 48
nms applies the adjacent block destruction recursively
which means that if you can find an event that is guaranteed to fire after the block explodes/breaks, and compare all blocks that have been destroyed since an event that is guaranteed to fire before the block explodes/breaks, you get an accurate list
wasn't the explosion event async at this stage though?
i doubt any of that shit is async
but block breaks are sync?
i don't remember anyone ever mentioning that explosions were on some level async
maybe on some 1.8 "cannoning" fork
fucking 1.8
maybe I'm misremembering things, I thought it was a relatively recent-ish vanilla mc thing
Is there a armor wear event?
Okay, thank you 😄
pretty sure changing armor still triggers some generic inventory events fyi
yeeeah but you'll have to listen to like 3 or 4 different events
such is life
and it's still not reliable
pretty sure the people who have to use spigot just check every armor slot every tick
Is paper api a fork of spigot?
paper is a fork of spigot yes
with a bunch of quality of life improvements and additions
it's api-compatible with spigot, so all of the things written for spigot work for paper without changes
Okay thank you
BUT things written for paper may not work on Spigot
https://paste.turingarch.com/paste.php?id=92
(I wanted to bring a signage status system to my test plugin, but I couldn't start the plugin)
Paste can store text, source code or sensitive data for a set period of time.
like game status: recruiting, starting, ingame etc..
Code?
Looks fine I would add a check to make sure that the block actually is a sign
just a test plugin, i dont need that for now,
I am skeptical about the location of the signs. I don't know if the coordinates are exactly correct
I got the coordinates like this
Hence why you add debug messages and if statements
I need help, because this doesn't work... correctly... when I try the player send data, it does not work correctly but the server one works
ah, i think error is here, so WorldCreator 🤔
Yeah that's not much info
Player send is queue backed and ONLY works if the player is online
server send will blindly attempt to send and will drop messages if no one is online
No, the player doesn;t actually exist untill that event finishes
then when would you be able to send data as fast as possible...
come on everybody let's do the conga!
yu're mutant
Don't forget to register it in the plugin.yml
Noted
thank you.
JSONObject obj = new JSONObject().put("content", "");
Type mismatch: cannot convert from Object to JSONObject
wat
will this filter out all materials with the string/char sequence "restone" in it?
I think the API for the BlockState should come with a warning that working too closely with BlockStates might lead to higher blood pressure and depression
lmao
A
@chrome beacon talking to me?
how would you get the block a player is looking even if they arent selecting it?
Yes
get their angle, and position
like its out of their reach
wdym
bro just cast bad code to good code
Ok then what should i do
oh
what do you mean create a new json object
isnt it already doing that
...
JSONObject obj = new JSONObject().put("content", "aaaa");
don;t do the put in the same line
^^
ok
Yes
thanks
ill try it rn
now this is throwing an NPE
plugin.getConfig().getConfigurationSection("blocks").getKeys(false).forEach(key ->{
i think its saying plugin is null..
theres no reason for it to be null
there's a lot of assumptions in that code
that plugin isn't null, that config isn't null, that that config section exists and that it has keys
the config is there, the the seciton is there, it does have keys
leme show where plugin is defined
I'm sure you wrote it but is the plugin actually reading it
that's 4 different checks you should be doing
ok
well the config was working before
And it was reading it properly
this whole line was working
I didnt touch it at all lol
"well X was working before" is a timeless classic on par with "well it works on my machine" and "why is it working now?"
leme debug rq
why the hell does this not work.
idk
f word
so I scan every block in an explosion, I scan every adjacent block and still I am losing lanterns to drops somehow
this is fantastic fun
Maybe try putting all of it inside the if statement ?
waiting
both the adjacency code works and the immediate explosion code works
god knows what edge condition this is
wdym
i did all the stuff to register the listener
but the debug log is nowhere to be seen
!paste
If have this piece of code to check if the value of Saddle is set to true or false, if its true it will add the recipe to the server but I want to remove the recipe if its not true but how can I do this?
if (this.getConfig().getBoolean("Saddle")) {
this.getServer().addRecipe(recipeSaddle);
} else {
//remove recipe
}
does your recipe use a NamespacedKey?
Yes I think it does
private Recipe recipeSaddle = (new ShapedRecipe(new NamespacedKey(this, "SADDLE"), new ItemStack(Material.SADDLE))).shape(new String[]{"LLL","LIL","SSS"}).setIngredient('L', Material.LEATHER).setIngredient('I', Material.IRON_INGOT).setIngredient('S', Material.STRING);
It doesnt work, I have this rn
this.getServer().removeRecipe("SADDLE");
Oh wait im sorry im working on a 1.12.2 plugin and there is no removeRecipe() in 1.12.2
So my question is actually how do I remove a custom shaped recipe in spigot 1.12.2
Do you how I can do it with spigot 1.12.2?
uhh I don't think you can remove recipes... in that old version
well you could with ALOT OF reflection.
Reflection is like
indicating what you want to do
in an non easy way
let's say that way.
in lower versions you do
No you dont
to remove recipes
declaration: package: org.bukkit, class: Bukkit
the removeRecipe
i believe
for NamespacedKey
he ofc didn't read "lower versions"
thats 1.16.5
who cares
Nope, its available in lower versions
the version is just there cause
you know its docs but yes
the method is still there
in older versions
No its not
for NamespacedKey
false
You cant use removeRecipe() in 1.12.2
for NamespacedKey too..?
So then I would use this code
this.getServer().removeRecipe("SADDLE");
But it doesnt work
i am not even referring to that
i know right
ok im not talking to you. I literally said so many times NAMESPACEDKEY
NOT BUKKIT
Jesus
Pulse im using a namespacedkey
and then this code doesnt work
this.getServer().removeRecipe("SADDLE");
omfg
Now i see nvm the method accepts a NamespacedKey
lol
incompetent piece of garbage
but what i specifically meant more was about using the event perhaps
and setting it to air
shut the fuck up cause your code is shitty lmao
ok im joking
don't even
but Pulse do you know a solution?
You could use a crafting event for this
and check the contents, set the result to air
for an unwanted recipe
as a reference, here was his code lmao: https://paste.helpch.at/butufaxavi.cs
Idc.
if you're here to trashtalk me
you can leave the server.
it's easy.
button exists for people like you.
seems like a mom
im not... i was in the server for a while already and have helped many kids before
lmao
ok boomer
not quite cheif
what is the problem again....
solution for?
After all, I did make a whole fucking list for you but you didn't listen to any of us
so
¯_(ツ)_/¯
the removing the recipe
what is the version again?
As a reference: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/CraftItemEvent.html
declaration: package: org.bukkit.event.inventory, class: CraftItemEvent
1.12.2
Take a look at the inventory, find the slots and check
it kills me that the one other portuguese dude in here is a jackass
this is inefficient...
I would say.
Well whats the efficient way then
lmfao
the actual efficient way is to actually remove the recipe
which can be done by accessing this.
in "CraftingManager", NMS.
ive got it stored as a hashmap
Yeah no. Idk if you want to modify those fields
in general, you should be trying to avoid Reflection for certain things. For example, I see no reason why you can't use the CraftItemEvent. After all, it is much safer
And the efficiency is super fast if you make it fast
it would still appear
you can use Hashing
What?
lol
omg
no
you can use the spigot api to make a recipe not appear at all
this?
hes using 1.12.2
THAT.
/\
"completed"
the recipe would still appear.
it would just not be craftable.
buddy I'm not saying you have to use that event
I'm saying it's possible
I've done it
I can even share the code if you stop being a jackass
Alright, I will stop
But I am just pissed cause of this guy from yesterday
do you have a big brain to help with this tho?
makes sense.
like
the message is just no sent...
I put "souts" everywhere.... in the plugin message and nothing..
I have registered the messengers etc.
Can you share it?
what should i provide for the cooldown?
im using this
pulse already shared the correct event, I don't think it's necessary anymore
the prepareitemcraft
Yes
yeah
oh okay thanks guys
me?
nah like the stop being a jackass
that was for the pt dude
🧢
you make portuguese devs look bad
Nah, they make themselves bad I don't have to interfere.
I don't even care about portuguese communities.
Pog
shame you still have the pt in your username then
can't change it, can't make it can't make it
at least I don't want money for a stupid plugin.... to then provide a bad job.
I mean why shame
scroll up and see the shit he's responding
well in all seriousness anyways, you don't know what risk modifying those NMS fields can lead to
technically yeah, but if bukkit done it, analyzing their code is a good way to know.
🥲
but ANYWAY move on
smh
Jads I highly recommend you to start with Haskell
Haskell?
Yup
very funny
don't even
don’t odd
does anyone have a spigot api compatible with assembly
can someone actually help here tho?
I'm delaying it because it didn't work even without the delay, anyway, anyone knows why the spigot doesn't receive the plugin message?
lol
very mech
Yep
yes
Jadss pro tip have bungeecord set to true in spigot.yml
now I need to sort blocks bottom to top, I could be clever but I think I might just iterate through y=0 to y=256 lol
Ok did you register the outcoming channel
very positive I have that..
.
Idk people make silly mistakes all the time so better safe than sorry wouldn’t you say?
Ok sounds pog .........
but none are received...
And if you’d use a different channel
as far as I know, you can't use another channel...
only "bungeecord"
or it doesn't work
That’s not true
it still should work...
Not so sure
you
"BungeeCord"
capitalization matters
using capitals will make viaversion stop it
If you’re using the pmc api as a messaging service then you should use smtng like pluginName:channel
Or smtng
do you have a incoming listener then on bungee with the lower case?
they are both lower case.
the channel name is 'BungeeCord'
What ver are are you running on Bungee and Spigot
I'll try "BungeeCord", 1s
Im guessing there has to be a way for viaver to stop blocking channels but I would find it really stupid if they do block it.. especially the BungeeCord one
'bungeecord:main' is the alternative
they do block uppercase stuff on channels...
Yeah
Then do what MD just said as the alternative
iirc that’s the case
'bungeecord:main'
ik luckperms uses luckperms:update for instance
Yeah redis >> pmc
most things are better then PMCs lol
I do use them for client specific data to the server
I mean sometimes pmc is needed inevitably
yeah
But yeah as a messaging service redis = dope
It’s weird that so many hate jedis cuz it isn’t multithreading or smtng iirc
I suck at redis though lmao
Iol yeah same
well...
it didn't block it...... or at least didn't say it was ignoring it, which is what it would do.
then you should be all good
not quite...
So whats your problem now
probably cuz of my dumbass
Pulse I will make an attempt to convert media lib to gradle
is there a method for getting the player's currently held item's slot #?
Isn’t that a method in PlayerInventory
yes getHeldItemSlot if not mistaken
ah yes i was searching for hotbar
and PlayerInventory starts with the hotbar being 0-8 right?
ya
Yeah that should be correct
How would i kick all players from the server?
iterate through all of them and kick
Do you recomend eclipse or intelliJ
intellij
IntelliJ, i moved recently and it's just better overall in my opinion
Does anyone know how to remove a recipe in spigot 1.16.5
eclipse is basically a funny prank developers play on new devs
Use the recipe iterator iirc jakob
Isnt it more effiecient to use the removeRecipe method
C:\Users\hudgr\Desktop\Mcserver\WIP plugins\src\com\quartir\worldreset\WorldReset.java:4:8 java: class SpigotBlankPlugin is public, should be declared in a file named SpigotBlankPlugin.java
I think i made a fucky wucky
You're iterating onEnable anyway, efficiency shouldn't matter too much
But I dont really know how to do that
you have two public classes in one file
yikes
how 2 fix?
move it to a separate file
Big brain
bro
didnt i tell you this already
lmao
is the slot of the off hand 36 or 40
45
private Recipe recipeSaddle = (new ShapedRecipe(new NamespacedKey(this, "SADDLE"), new ItemStack(Material.SADDLE))).shape(new String[]{"LLL","LIL","SSS"}).setIngredient('L', Material.LEATHER).setIngredient('I', Material.IRON_INGOT).setIngredient('S', Material.STRING);
no
there's no way that's right
you need a namedspacekey
im not sure if that is credible tho
i just looked it up
lmfao
NamespacedKey.minecraft("SADDLE") probably
it's wrong
Or smtng
0-8 is definitely hotbar
i dont think the crafting slots are even part of PlayerInventory
How 2 export plugin intelliJ
press the red x in the top right
Did not work.