#help-development
1 messages · Page 1783 of 1
xD
ye lmao
:D
Social work
haha
;D
is md_5 the creator of spigot?
or just the project lead nowadays?
and is he the owner, or just one of many admins?
just wondering
i see
thats cool
i wonder why he's even studying
im making my bachelors degree now and he's like levels above me
is it hard to make something like spigot, forge, mcp, .. ?
do you just somehow decompile the code and inject your own methods
xD
md_5 goes to interview, and instead hires the interviewer.
is location passed by reference? (I know there is no pass by reference in java, so for all the pros: Is the reference passed by value, or is a copy passed by value?)
Or in other words, does p.getLocation().setYaw() or Location x = p.getLocation(); x.setYaw(); actually change the players yaw?
getLocation will return a copy of the Location.
^
alright, thank you
you need to teleport them
alright, ty
is the release today?
damn, time went fast
no, 1.17.1 is still the newest
@summer scroll
1.18 release is November 30th
well i'm asking
ahh
it keeps getting heavier and heavier
What does
you know, to run a server with the newest version
The extra 64 blocks of cave generation certainly doesn’t help
yes there is, at least I think so
I think you have to put the ? at the end in ''
probably want to use getString or whatever it’s called
how far should i go in learning java before passing to spigot ?
where ?
Learn the fundamentals
yeah, u dont need to be far, spigot is super simple
Classes, objects, variables, iteration, methods etc
are you trying to check Where name = '?' ?
dont you have to do * instead of ?
no dude wtf performance 0
i used this query in other projects but it was not a getValue
it had a fixed value like presents
and i called the method right
what is wrong
ugh i thought i learned those but when i go into making a plugin i understand nothing lol
Then you didn’t learn those enough
not sure tbh
a mutator method
what does that mean
ok i'll go back to it
Is there any way to do this
Location loc = p.getLocation();
loc.setPitch(60f);
p.teleport(loc);
in one line (or in two?) ? (without creating a new Location(...))
set just returns a void, it would be so handy if there was a method that returns the changed object
its not much, but just wondering if there is
p.teleport(p.getLocation().setPitch(60f));
setPitch returns void :/
ah
yeah :((
does it matter?
nah, but would be nice
no i mean. does it matter that setPitch returns void
you set the pitch of the location to the specified value and then teleport the player to that location, right?
how could i reorder the items in the inventory?
oh I see now
xD
this -> this
ah thats what u mean xD
can anyone help me ?
probably with a for loop just counting (and deleting) the items of that type
and then add the appropriate amount in empty slots
add all the items in a list and then sort the list, then put the items from the list into the inventory after clearing it (the inventory) would be the first thing that comes to mind
thats not what he meant, look at the picture @crimson terrace
or i understand you wrong
shreb is correct
oh alright
taking the items out, then adding them all back (not in a slot) will stack them
does sorting the list stack the items?
i mean something like go through every slot in the inventory, add it to a list (if the item is already in the list you just add the amount to that itemstack) and then put them back in
sorting doesnt stack but i forgot to mention the stacking yea
now depends on if he wants to do it for every item or just a specific one
depending on that he needs a list or not
most likely for every item
in the example its just one
but yeah, might be
Can you change the players rotation without him actually turning?
so its just instantly changed, no animation
Location loc = p.getLocation();
loc.setPitch(60f);
p.teleport(loc);
This makes the player turn super fast to the desired pitch. But I dont want there to be a turn animation
the animation will be client side extrapolation
you don;t
extrapolation? isnt it called interpolation?
"Thats the neat part, you dont"
:(
yes and i forgot to disable the autocrafter and i was wondering why it was adding more items 🤡
Can you display a map to the player as if he was holding it, without him actually having it in his hand?
No
did they change NMS? Like it is in the META_INF/versions folder now
im so confused
lol
i understand why they have it like that now (cause of bootstrap class and they need to load libraries like jars and stuff), but how would i use it now lol
Should i do Map<Player, ...> or Map<UUID, ...> ?
Can the former be a problem? Or does storing a Player use uuid under the hood anyway?
you should do the latter
Because player objects become invalid if the player logs out
if they log back in, a new player object is created
i remove from list if he logs out
but alright, good to know
will just use uuid to make sure
Then you are better off using a map with weak keys
whats that
WeakHashMap
so that the player object will be garbage collected automatically once they log out
ooh that exists? whaaaat
yes
thats so useful
May be garbage collected
Yeah
how often does the garbage collector run
it depends
random
hmmm
idk if i should use weaklink or remove at logout
gotta think about it more xD
you may end up with objects that need to be garbage collected, but you won;t cause a memory leak using a weak map
^
it will however eff up your code
alright
Yeah the new jar in jar stuff with minecraft is weird
its cause of jdk 16 library loading
but intellij is indexing the wrong shit now
Hello, is it possible to sort the players on the basis of their group in the tab list without scoreboard (1.16.5)
you mean paperweight?
When I cancel PlayerInteractEvent, does it stop the player from breaking stuff?
If not just use the BlockBreakEvent
yea
Why do some event.getPlayer()-methods return HumanEntity and some return Player ?
whats the point of that?
Honestly I’m not sure
Afaik all HumanEntity are players
Might be to do with how the underlying packets work
hmmm
maybe md_5 just choose to change it later on, but didnt wanna change existing methods?
but spigot isnt really downwards compactible, is it
im pretty sure than human entity is both npc and player
welp lemme check crafthumanentity
i have it here
ahh yes
/**
- Represents a human entity, such as an NPC or a player
*/
alright
yeah
but backwards casting isnt good xD
player -> humanentity is alright, but humanentity->player is bad, cuz if its not a player its gonna give an error i think. but ill just cast anyway, wont use npcs in my plugin. ty.
downcasting is not entirely bad
it really depends on the situation. you mostly downcast if you receive something where you already know what it will be. in this case, as long as you know that it will be the player, you can downcast, but it will probably not give any advantages
well, can NPCs trigger InventoryClickEvent?
idk
xD
But yeah, i kinda know only players will trigger it in my application
a NPC is also a player
but not a real one, right
its a fake player but afaik it will also trigger events
if the plugin dont do some wunky things then i guess they arent gonna trigger any inv events
might be block breaks or other events like that
since inventory interactions need to happen clientside first and a NPC doesnt have a clientside, they wont
How do you create smithing table recipes? all i can do with this code is 'getAddition' and 'getBase', not set it.
swordRecipe.```
wrong code
after
swordRecipe
i cant set recipes
Is there a reason why neither the PlayerPortalEvent nor EntityPortalEnterEvent catch END_GATEWAYs?
?paste
report to Malwarebytes if you can as a false positive
ok
i mean, if i post my malware code on it, they are not wrong
hello. i need a little help in my crafting system. Basically this code is a bit weird (https://paste.md-5.net/vihahecuhe.php), see the video to understand. Basically, if i put 3 iron, it crafts 1 bucket but if i put 1 iron, it crafts 1 bucket as it had 3 iron. following that logic, if i put 4 irons, it crafts 2 buckets (3 iron for the first bucket and 1 for the second)
Can someone help me I need H E L P
https://paste.md-5.net/nuzuvavota.cs
The material is just null no matter what
like if I paste the value it says WHITE_WOOL but it says the material is null
paste the full error
ok
and use matchMaterial not valueOf
cant you get a number of all iron ingots in the chest and then do a for loop or while loop and craft them 1 by 1 if the number can be divided by 3, so like if there 78 ingots, check if it can be divided by 3 - 26 and as long as its above or equal 1 youre good (2/3 = 0.666)
?paste
that seems to fix it idk why
Caused by: java.lang.IllegalStateException: InventoryOpenEvent cannot be triggered asynchronously from another thread.
?
Is that for me or?
it looks like it is
yes
call it in a sync method to the main thread
are you firing this from a command?
an async event
um yea
then just run task
execute a task it will run sync to teh main thread as it goes via the scheduler
ok
does p#getLocation return the death coordinates if i call it in the PlayerDeathEvent?
yeah i think so
hello
what is the material for a golden apple
and an enchanted golden apple
in 1.12.2
does not exists
and wait
GOLDEN_APPLE is enchanted golden apple i guess
what is for the normal ?
the api version is 1.12.2
not in the plugin.yml
the whole api thing
as the server is
Then it should just be GOLDEN_APPLE / ENCHANTED_GOLDEN_APPLE
nope
hey
so i made a plugin
and tested it on a 1.8.8 server local host
and it worked well
but then i uploaded it to my server
and it didnt even show in /pl
not even red
idk what the issue is
What does show up? (Is there an error in the console)
can anyone help me ?
no nothing
When loading the plugin?
i restarted server
Have you double checked that your server is spigot 1.8.8
yes
i use multiple 1.8.8 plugins on it
and they all work
and i am sure that none of them does the same things my plugin does
like basic /gmc etc
Does your plugin print something to the console if loaded?
i just restarted server to see if any errors and only error that shows is about protocol lib
no i tried ctrl+f to see if there's anything
and nothing came up
idk its just weird
Is it in the right folder?
like this?
not a timer#
oh
you only want to run once
the plugin's name is BwCore
Does your local host and server have the same jar?
I mean I guess
idk about that
But why bother with a repeating task when you don’t need one
i'll try uploading the local host jar into the server
Can you check?
yes ok
Can someone help me, My item isn't enchanted but I have the lore correct. I don't get why the enchant isn't working ``` public static void init(){
createAxe();
}
public static void createAxe(){
ItemStack Item = new ItemStack(Material.DIAMOND_AXE, 1);
ItemMeta meta = Item.getItemMeta();
meta.setDisplayName("§4Battle Axe");
List<String> lore = new ArrayList<>();
lore.add("A axe for hero's and warriors");
lore.add("luck is on your side");
meta.setLore(lore);
meta.addEnchant(Enchantment.MENDING, 2, false);
meta.addEnchant(Enchantment.LUCK, 20, false);
//meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
Item.setItemMeta(meta);
battleAxe = Item;
}
}```
wow i actually kind of understand this lol
Where do you host?
i use soulnode
am uploading the jar file from the local host to replace the one on the soulnode server
and then i'll restart
Have you tried downloading the server jar from there and test a local host server with the plugin?
Why would having lore make your axe have an enchantment glint? I don't see an issue with your code.
am trying this rn
and if it doesnt work i'll try this
He meant that the enchantments aren't applied but the lore works. No relation of lore and enchants
rip just did this and the plugin didnt show up
now i'll try this
To take the # value, would be getInt, getDouble or getString?
I mean, to getting it in the config
ok
new NamespacedKey("combined_sword"), sword);
new ItemStack(better_netherite_sword);
new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD);
new RecipeChoice.ExactChoice(Material.DIAMOND);
Bukkit.getServer().addRecipe(cmbnSword);``` gives me this error
it worked ...
that means its a plugin that's causing that ?
Try putting all the plugins in the local host folder
how can i detect when the player looks around just a little?
the PlayerMoveEvent is only getting triggered after a rotation of > 8 degrees
Runnable I guess
what
check wether their location is the same every couple ticks
wonder if thats laggy
o
You need a plugin instance
Or you need to use NamespacedKey.fromString
idk
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
How could I check if a player broke a specific block (a player head)
using NamespacedKey.fromString instead of constructor is api abuse SMH
ok so i looked on threads and found that someone said that the server doesnt support the java i compiled with
how can i make the plugin java 8 ?
its in latest java version
the head has a PDC persistent data container
60:36
java: constructor SmithingRecipe in class org.bukkit.inventory.SmithingRecipe cannot be applied to given types;
required: org.bukkit.NamespacedKey,org.bukkit.inventory.ItemStack,org.bukkit.inventory.RecipeChoice,org.bukkit.inventory.RecipeChoice
found: org.bukkit.NamespacedKey
reason: actual and formal argument lists differ in length
Change the used java lib for the project
that's here
SmithingRecipe cmbnSword = new SmithingRecipe(
LoL did you just answered to yourself
U using eclipse?
ok i'll look for that
no because idk how to check a blocks PDC
intellij
Ah ok, can't help there
get the block state
F
ok
and then cast it to PersistentDataHolder
Tnx xD
But I think it's in the properties of the project
and how do i do that
there's a folder called lib
but idk what i need to look for
cuz too many things on there
PersistentDataHolder pdh = (PersistentDataHolder) state;
I love oracle
how can I use getConfigurationSection and look through?
getKeys
no 1.8.8
is head a tile block? a chest is
Create a Main singleton which you call in the Name spaced key
Its not
alright
A head is, yes
ah wait
Gotta store the texture somewhere
like a block
I messed up Storage and TileEntity
Download a jdk/jre in version 8-11 as most servers support that
where can i find java 8 ?
Yeah head is TileEntity
i found it on oracle website
ok
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
Pretty sure that has a 8 build as well
thanks
See Adoptium aka AdoptOpenJDK
yes
ItemStack(better_netherite_sword), RecipeChoice(Material.DIAMOND_SWORD), RecipeChoice(better_netherite_ingot) these three want methods but idk what that means 🥴
what methods do i add?
I've tried about every possible thing I could think of (including this mess) but whatever I do it still says it "Might be null". Does anyone know why?
What would be the best way to load worlds on server start to prevent getting unknown world errors?
right click then find cause
why doesn't execute the code?
@EventHandler
public void onInteract(InventoryInteractEvent event) {
Player player = (Player) event.getWhoClicked();
System.out.println(1);
if(Menu.getOpenedMenus().containsKey(player)) {
System.out.println(2);
Menu menu = Menu.getOpenedMenus().get(player);
menu.onAction(event);
}
}
is your event registered?
yes
and the 1 is not printed
no
maybe you want to use InventoryClickEvent
Probably
How can i run a method when a player clicks a message?
Actually, certainly
won't it work with InventoryInteractEvent?
The interact event is abstract and cannot be listened too
ty
this fixed my issue
is there any argument that shows all commands on the plugin ?
like /plugin
shows all commands that the plugin does
or do i have to type it all ?
ok i'll try that
Don’t press enter
Just type /pluginname and it will suggest all the registered command for it
Caused by: java.lang.IllegalArgumentException: Cannot translate null text and the text is '&2&lZombie Head'
private static File file;
private static FileConfiguration customFile;
public ArenaConfiguration() {
file = new File(TIMV.getInstance().getDataFolder(), "arena.yml");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
return;
}
}
customFile = YamlConfiguration.loadConfiguration(file);
}``` I keep getting an error with this `customFile = YamlConfiguration.loadConfiguration(file);` upon loading the server and I'm not sure why because it should load it fine. It has a bunch of locations in it. This is the error ```Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization
java.lang.IllegalArgumentException: unknown world```
World isn’t loaded yet
@young knoll
not a thing in 1.8 afaik
I have a method for it. It selects a random map thats going to be played and then loads that one with this
private void load() {
String world = arenaConfiguration.getConfig().getConfigurationSection(getSelected()).getString("worldName");
//Bukkit.unloadWorld(world, false);
Bukkit.createWorld(WorldCreator.name(world));
}```
Is that run before the config stuff
is it possible to get an offline player's uuid ?
or like issue command on an offline player ?
./ban
I load the arenaconfig file before the location file in onEnable
@Override
public void onEnable() {
// Plugin startup logic
arenaConfiguration = new ArenaConfiguration();
locationUtility = new LocationUtility(arenaConfiguration);
}```
You have to load the world before you load any locations
and world loading is not instant
LocationUtility selects a unloaded world from arenaConfig and then loads that world after
I dont think im using any of the locations first
you can;t even read the locations until the world is loaded
I know. I'm loading the world first
your error says you are not
worlds do not load the instant you tell them to
it takes time
There should be a callback function for that
Can I DM the full src so it's easier to see what its wrong because I'm not the best to explain
I hate package naming convetions
if I have a project called Super Awesome Bot what in the hell should be the package name
super-awesome-bot? SuperAwesomeBot <- no capital letters in package names argh
askdfljlsdf
yes
Whats wrong?
Usually it’s the domain name but reversed
Or well your domain whatever you might own
Is there a world#isLoaded?
also you can easily mess up classes with packages
How to update my config in a bungeecord plugin? Like how do I add all the new sections that are created? There's no copyDefaults() option.
I believe world objects can only have loaded state?
?jd-bc
Just wondering
it says'
Unsure whether there’s such a method
ItemStack(better_netherite_sword), RecipeChoice(Material.DIAMOND_SWORD), RecipeChoice(better_netherite_ingot));
the error is
symbol: method ItemStack(org.bukkit.inventory.ItemStack)
location: class com.ragery.customitems.items.ItemManager```
new ItemStack(Material)
In Java you must use the new keyword before the constructor invocation when creating an object
python thoughts
i added new to all
java: org.bukkit.inventory.RecipeChoice is abstract; cannot be instantiated
new error
That too, the class must be concrete if you’re going to instantiate it.
how
Well are you trying to do?
also i want the addition
smithing recipe
instead of the netherite ingot
to be a custom item
so idk if this will work
instead of normal
I am just not too sure if - should be in a artifact name
artifactId? Fine. In group id and packages i'd use superawesomebot actually
hello everyone! i have a question regarding build tools for yall,
i am currently watching a tutorial about nms and in the tutorial they opened up the build tools library or something,
does anyone know how they did that? like the source code for craft bukkit and stuff
can i use an itemstack instead of a recipe choice for the smithing recipe?
but does exactchoice let me do itemstacks
I need help, so I have a item in my inventory that has a NameSpaced Key, and when I break that item (when its placed) how will I know its that item, in other words, how will I get the blocks Namespaced key
I put that NameSpaced key in the items PDC
PDC is not transfered to the item when its placed as a block
IF the placed block has a PDC then you have to manually add it when placed
only blocks which have TileEntities have a PDC
ok so
the thing is
i need diamond sword + <custom item> = <custom sword>
but the custom item is a netherite ingot
and the sword is a netherite sword
how do i get it to override
then use a shaped recipe
then use the correct ItemStacks in your recipe
wdym
a netherite ingot (custom) and an diamond sword
the result should be my custom itemstack
and the base can be a normal diamond sword
- my new ingot
my code is
you only get one result in a recipe
SmithingRecipe cmbnSword = new SmithingRecipe(NamespacedKey.fromString("combinedSword"), new ItemStack(better_netherite_sword), new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD), new RecipeChoice.ExactChoice(better_netherite_ingot));
but can i make the custom ingot make it have a different recipe?
thats not a valid NamespacedKey
there's no error
its not valid
how do i make it valid...?
is yoru better_netherite_sword already an itemstack?
yes
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD, 1);
ItemMeta swordMeta = sword.getItemMeta();
swordMeta.setDisplayName("§bSuper Netherite Sword");
List<String> lore = new ArrayList<>();
lore.add("§eThis upgraded sword");
lore.add("§ewill boost your stength");
lore.add("§eand give you an ability!");
swordMeta.setLore(lore);
swordMeta.addEnchant(Enchantment.DURABILITY, 4, false);
swordMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 4, false);
sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
swordMeta.setCustomModelData(2);
sword.setItemMeta(swordMeta);
better_netherite_sword = sword;```
then use it, not inside a new ItemStack(bether_etc)
you use better_netherite_sword
so if i remove the new
SmithingRecipe cmbnSword = new SmithingRecipe(NamespacedKey.fromString("combinedSword"), ItemStack(better_netherite_sword), new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD), new RecipeChoice.ExactChoice(better_netherite_ingot));
no
it gives me this
take out the ItemStack( )
JUST better_netherite_sword
and fixc yoru NamespacedKey
new NamespacedKey(plugin, "combinedsword")
Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.```
so the 'plugin' is the name of my plugin or the word plugin?
its an instance of yoru plugin
yoru main class
this if this code is in your main class
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
new SmithingRecipe(new NamespacedKey(CustomItems, "combined_sword")
customitems is my main class
it has to be an actual instance not just the class
this gives me this error
how do i make an instance
java: cannot find symbol symbol: variable CustomItems location: class com.ragery.customitems.items.ItemManager
Bukkit.getPlugin(CustomItems.class)
getPlugin is not there
java: cannot find symbol symbol: method getPlugin(java.lang.Class<com.ragery.customitems.CustomItems>) location: class org.bukkit.Bukkit
new SmithingRecipe(new NamespacedKey(Bukkit.getPlugin(CustomItems.class)
then Bukkit.getPluginManager().getPlugin("CustomItems")
ok
no error but
lemme see if the recipe works
lol it's getting stuck at running ant tasks
now stuck at
synchronizing output directories
Does anyone know why I can't set the END_GATEWAY ExitLocations like this?
//set blocks to END_GATEWAY
portalBlocks[0].getBlock().setType(Material.END_GATEWAY);
portalBlocks[1].getBlock().setType(Material.END_GATEWAY);
destPortalBlocks[0].getBlock().setType(Material.END_GATEWAY);
destPortalBlocks[1].getBlock().setType(Material.END_GATEWAY);
//set exit locations of all portal blocks AND set them to be exact
((EndGateway) portalBlocks[0].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
((EndGateway) portalBlocks[0].getBlock().getState()).setExactTeleport(true);
((EndGateway) portalBlocks[1].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
((EndGateway) portalBlocks[1].getBlock().getState()).setExactTeleport(true);
((EndGateway) destPortalBlocks[0].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
((EndGateway) destPortalBlocks[0].getBlock().getState()).setExactTeleport(true);
((EndGateway) destPortalBlocks[1].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
((EndGateway) destPortalBlocks[1].getBlock().getState()).setExactTeleport(true);
It doesn't result in an error.. it just doesn't work
hello how to kill a player, and set the killer of the player to the last player that damaged the player ?
nvm found it
Keep in mind for smithing recipes the meta of the result is not applied
do i have to add it like i did with my shaped recipe like this?
Bukkit.getServer().addRecipe(sir); (thats the shaped)
do i need to do it with the smithing recipe
i tried
Bukkit.addRecipe(cmbnSword);
and now im trying
Bukkit.getServer().addRecipe(cmbnSword);
it's still just giving me the default thing
dang
that means
it wont work
how do i make metas apply
Use the PrepareSmithingEvent
What's the best way to check if any player is at a specific location?
idk how to use events
Move event probably
register event class
Could I loop through the online players and check their location against another location?
You could
Depends how often you want to do things
As that may be slower than the event
always remeber to have @EventHandler over like
``@EventHandler
public void CustomMelting (PrepareSmithingEvent e){
}
``
in your Event Class
I'm already doing it through a different event
but what do i do with my existing code
and i dont even have an event class
IDK WHAT THAT MEANS
Make a normal java class
You might wanna peek at java first, before tackling spigot*
what do i do with this
"combined_pick"),
better_netherite_pick, new RecipeChoice.MaterialChoice(Material.DIAMOND_PICKAXE),
new RecipeChoice.ExactChoice(better_netherite_ingot));
Bukkit.getServer().addRecipe(cmbnPick);```
i realize
now
ok
in my main folder?
Click on Create new java File
what you use?
where
the program you use to code in it?
Generally I have a folder for event listeners
ok
but tip it to keep your source organized and clean + simple to read
avoid terrible naming because it confuse people
it's giving errors
@EventHandler
public void CustomMelting (PrepareSmithingEvent e){
}
}
p
gimme one sec
i changed
bc not custommelting
but
i imported the classes
what do i do with this code tho
import org.bukkit.event.inventory.PrepareSmithingEvent;
public class EventClass {
@EventHandler
public void CustomItemRecipes (PrepareSmithingEvent e){
}
}
i have to reference the class right
public class EventClass implements Listener {
in the class with the items correct?
yea
but now what
does it just
work lol?
i have that
ok
now to register events
but using
( [Main / Main Instance] here -->) .getServer().getPluginManager().registerEvents(new EventClass(), Main / Main Instance );
after you registered you events should work!
depends how you want it?
or my items class
i can teach how to register from other classes
confused
where do i implement this
in my recipe?
you can do it Any Class
the registering
at the top?
but if you want the simple way just
put it in on enable
do this.getServer().getPluginManager().registerEvents(new EventClass(), this);
(this) will referrer to the main class itself
ik thanks
tysm
lemme see if plugin works
it should
nope
public class EventClass implements Listener {
java: class EventClass is public, should be declared in a file named EventClass.java
but it is
show your EventClass
have you implements the register listener?
wait does that code need to be in the class as well?
yes do that
?paste
import org.bukkit.event.inventory.PrepareSmithingEvent;
public class EventClass {
@EventHandler
public void CustomItemRecipes (PrepareSmithingEvent e){
}
}
you aren’t implementing the listener…
lmfao
because its not being used
exactly
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareSmithingEvent;
public class EventClass implements Listener {
public class EventClass {
@EventHandler
public void CustomItemRecipes (PrepareSmithingEvent e){
}
}
I wonder what the issue is!
not like he was 1 class in the class
import org.bukkit.event.EventHandler; import org.bukkit.event.Listener;
public class EventClass implements Listener { this doesnt need to be in my main class right
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareSmithingEvent;
public class EventClass implements Listener {
@EventHandler
public void CustomItemRecipes (PrepareSmithingEvent e){
}
}
:(
no no that is a class from itself
an asperate file
import com.ragery.customitems.items.EventClass; in my main
java: cannot find symbol symbol: class EventClass location: package com.ragery.customitems.items
it no work
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
instead of spoonfeeding
this is basics
i wanna see if you made mutiple Classes in same file or something
Just learn java! It will save you a lot of damn time
thanks...
#help-development message if you read this you can clearly see the issue
wait a sec
are you trying to run a spigot plugin?
that won't work on in a spigot server
paper server
that would work too
would or wouldn't?
we made him register Listener
(╯°□°)╯︵ ┻━┻
.
┬─┬ ノ( ゜-゜ノ)
¯_(ツ)_/¯
they put a class inside a class and 1.) that second class doesn't even implement listener, but even then that's completely unnecessary
remove the second class and put the eventhandler method in the first class and boom bam bosh look no error
😳
wut i missed?
public class EventClass implements Listener {
public class EventClass {
oh gee i wonder why it dont work
Oh gosh no
read the errors
D::
java: class EventClass is public, should be declared in a file named EventClass.java
panik
now send your new error and the code that it references
line 32: runnable cannot run, none one is running.
tho I just recommend learning to problem solve your errors yourself & learning basic java :)
because I can assure you the errors you're having right now can be easily solved by just simply going through some basic java tutorials
public class EventClass { <--- this is a class
}
bump
avoid making a class in a class
?
because you don’t function fourteen
Life experiences 
there was no error
it just didnt carry
the metas
idk if the recipe is overriding the original recipe
what metas?
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD, 1);
ItemMeta swordMeta = sword.getItemMeta();
swordMeta.setDisplayName("§bSuper Netherite Sword");
List<String> lore = new ArrayList<>();
lore.add("§eThis upgraded sword");
lore.add("§ewill boost your stength");
lore.add("§eand give you an ability!");
swordMeta.setLore(lore);
swordMeta.addEnchant(Enchantment.DURABILITY, 4, false);
swordMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 4, false);
sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
swordMeta.setCustomModelData(2);
sword.setItemMeta(swordMeta);
better_netherite_sword = sword;```
whoa
return values exist
ok
Arrays.aslist exists
jmbed4f65rtvygbuh78ygih
i didnt know that when i made the code xD
i know that now
Oogalaga did you get this code off google?
no i wrote the code
stackoverflow is also google 🌝 😳
Arrays.asList(" myString 1 ", " myString 2")
he pro
that isn't the issue at hand
For some reason I don’t believe you
and i dont feel like changing teh code rn
should use ChatColor for color codes in text instead of the weird squiggly § symbol
k
i have
see
just not there
do it there too :)
lol i used §
lol
§ gang
i use &
anywayy'
ayaaa
if your code look like this
public class EventClass implements Listener {
public class EventClass {
you're doing something wrong
where do i add the return value
you dont add it
public Class Cookie {
public Cookie getNewCookie() {
return new Cookie();
}
}
sedfgh
@round finch why're you like 60 years in the fucking past we've moved past that
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareSmithingEvent;
public class EventClass implements Listener {
@EventHandler
public void CustomItemRecipes (PrepareSmithingEvent e){
}
}```
This beginner Java tutorial describes fundamentals of programming in the Java programming language
sorry for not caught on yet.. i had to be sure from what i know
here an exemple
public String getName(){
return myNameString;
}
where does myString comes fom :kek:
to what?
i?
wut you need?
i make metas work with smithing recipeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
you want to set lore or something?
then you should show us the recipe
ok
again'
"combined_pick"),
better_netherite_pick, new RecipeChoice.MaterialChoice(Material.DIAMOND_PICKAXE),
new RecipeChoice.ExactChoice(better_netherite_ingot));
Bukkit.getServer().addRecipe(cmbnPick);```
return sword?
Imma ask something illegal - ||Where can i get hands on spigot 1.18 pre5?||
we'll just do the pick
i wont fall for any tricks
?
idk what's in there
buildtool?
buildtools
full code, no snippets.
ConstructUtensils
?paste
bro
and what's the problem?
this
this?
one sec lol
are you overriding default recipes?
that doesnt seem to work
that doesn't look like a furance
smithign table
remove the vanilla one
you have to remove the default one
but i want the vanilla one to still work
doesnt have it a lower priority?
recipes are by order
and recreate it in the plugin?
he adds his after the vanilla ones are getting added
for what
you cant have 2 recipes doing the same
that wont work with the same recipe
ok i can change the ingot to like iron
yea then it wouldnt be a function
one input would have 2 outputs
and server go
bye
bye recipe
bye server
and retexture it to use my own texture
just make custom item with new recipe
isn't it possible to override vanilla recipes?
i would set it on diamond pickaxe and make different recipes
but it's better netherite
change the output lol
that changes the default one right?
?
check for name = better netherite?
PacketPlayOutSetSlot requires int, int, int, ItemStack.
What are the ints for?
One is the slot, one is probably the id of the container (0 should be players inventory), but whats the last one? and in what order?
row and column maybe?
ig i could just
not use smithing table
and use crafting table
or just
make the ingot iron
and retexture it
oh, that would make sense, but kinda weird since it has always been just the slot number (0-35). ill try it
Why do you need packets for this
you can use optifine to change texture depending on the item's displayname
Up to you. Depends how many different files you want to develop for

