<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
#help-development
1 messages · Page 2294 of 1
@quartz gull
i love gh copilot
fiver will do the same thing
I'm trying to store a location in a config file, have I done this correctly?
no need to serialize teh vector just put "vector", vector
it will be serialized when its put in teh config
Is there a way to add a tab complete option to an already existing command on the server?
config.set("positions", List<Positions>)
yes, but pass something other than an empty List
yeah
otherwise I won't be storing anything
I've got a list of Locations
so now I need to turn all of them into positions
just add a constructor to your Position which takes a Location
I made a static method
that works too
cause it's a record, trying to make constructors was weird
saying they weren't canonical and must reference canonical constructors
but then it was saying the reference to this() must be the first statement
however that means I can't do anything else
is the use of static here ok?
yes
👍
im not sure, if I do structuremanager.Loadstructure("minecraft:structurethingy"); will it load it?
if that is a valid structure, it will load it and return a Structure
Just using the NamespacedKey it mush have been previously registered
If it has not been loaded/registered you would use java structuremanager.Loadstructure(getStructureFile(newNamespacedKey("minecraft:structurethingy")));
Why doesn't the event get called?
so im halting the server, saving the event and then calling it later
but it doesnt actually work
Firing an event yourself will do nothing other than notify plugins that an event just happened which didn;t
save the old and new current, then set those values on that specific block to trigger a new redstone event
no you raised an event
this is my 10th attempt at this
raising an event does nothing
I've tried many other things before raising events
getBlock
okay, let me restore my code real quick and show you what I was doing
getLocation and getOldCurrent, getNewCurrent.
anyway I can check this cast? Or do I even need to
store those
when you want to trigger it,
get teh block at that location, set old current, then a tick or two later, set new current
Nope
?paste
no to which question?
to both
ok
heres teh code https://paste.md-5.net/fufasoseca.java
I will supress it then
you never update the block blockState.update();
This line blockState.getBlock().getState().update(true, false); wipes out any change you just made
why does player.openEnchanting(null, true); not do anything? i've been struggling on how to get a command-based enchanting GUI, much like if you did /workbench and you could open a crafting table
k, well remember I tried 100 things before this, so thats why I started doing wacky stuff
each BlockState is a snapshot of that Blocks data. Work on One snapshot and then push it back with .update
so do use update?
yes, but on the same BlockState you made changes to
Do not get a new BlockState
BlockState state = block.getState();
state.setBlockData(data);
state.update();```
for (BlockState blockState : cachedData.cachedRedstoneActivity.keySet()) {
try {
org.bukkit.block.data.BlockData data = blockState.getBlockData();
if (data instanceof org.bukkit.block.data.Powerable) {
blockState.getBlock().setBlockData(data);
blockState.update(true);
} else if (data instanceof org.bukkit.block.data.AnaloguePowerable powerable) {
powerable.setPower(cachedData.cachedRedstoneActivity.get(blockState));
blockState.setBlockData(powerable);
}```
like that
top if
does jack
am I missing something?
at the end of making changes you call update
which is what am I doing?
only in one part of your if statement
oh wait
stop
errors
lots of errors
cant async apparently
k
let me not async
nope, no async world changes
someone told me to
so
technically its not my fault
omg it worked so well...
it was one pulse
I saw a report a few days ago that force opening enchanting tables may be broken, but I may have missed a part of the convo
why isn't this doing the right thing? java for (BlockState blockState : cachedData.cachedRedstoneActivity.keySet()) { try { org.bukkit.block.data.BlockData data = blockState.getBlockData(); if (data instanceof org.bukkit.block.data.Powerable) { ((Powerable) data).setPowered(cachedData.cachedRedstoneActivity.get(blockState)>0); blockState.getBlock().setBlockData(data); } else if (data instanceof org.bukkit.block.data.AnaloguePowerable powerable) { powerable.setPower(cachedData.cachedRedstoneActivity.get(blockState)); blockState.setBlockData(powerable); } blockState.update(true); } catch (NoClassDefFoundError e) { Logger.outdated(); } catch (Exception e) { throw new RuntimeException(e); } }
You need an actual table at the location for it to correctly operate
Else teh logic is disconnected
Looks like people are doing something similar, https://www.spigotmc.org/threads/custom-enchantments-in-enchanting-table.405471/
They are using actual tables
not actual tables
yeah whenever I use that language it never works
My current code is f*cked
One sec let me open my IDE and check enchanting
Is what I am doing too complicated and finicky to be done successfully?
um, What exactly are you trying to do?
Halt, stop all redstone activity
cease
then
any attempted redstone activity during that halting period is restored
I need help with loading a structure
after the halt
the restoring part is the part that isn't working
my original code worked, but it messed up the timings
so i started experimenting with other methods, but that didnt work either
to restore it should just be a case of making a single pule.
for any case?
is that one solution fits all?
and one pulse would be done using a runnable?
set powered
then off
after a tick?
surely that would mess up other contraptions that don't fit what I am doing?
You are going to have a nightmare accounting for every type of contraption
yeah well everyone using my plugin is pissed
and its bloody optional feature
now im behind on my normal release schedule
Shitty Microsft. Can;t login to minecraft
god don't get me started on that
my entire school switched from google suite to microsoft
now instead of gdrive we got onedrive
outlook
its absurd
boots up a cracked version
@eternal oxide Your one tick method works kinda
something it doubles the pulse
How can I avoid that?
Yeah I can;t test shit, auth servers are effed
Here is a straightforward question you might be able to help me with, how can I get the block that powered the block I am looking at and powering?
that is not easy
come on, should I just discontinue with feature?
tree search of the area is the only way I know of
thats not very efficient
yes
is there a difference between BlockPlaceEvent#getBlock() and #getBlockPlaced()?
Nothing by the looks
Nope. As the javadocs state: Just for clarification.
How do I update a redstone block that is stuck?
like if a repeater is powered but not moving, I break the repeater after it and it works
reduce or increase its charge
how can I recreate that in code?
can I update it without changing the charge?
does that method return false though?
you can lock a repeater by applying a charge to its side
if its behaving as locked you can setLocked(false) to unlock it
else you have to change teh charge level
yo, i have updated my config.yml in intellij, however when i build it and remove any files of my plugin on my server, it still generates the old config, help?
refresh (F5) the project in IJ
alright, thanks ill try it
now i have only half of my config after installing the plugin on my server wtf is wrong with my plugin
then your code is breaking it. probably setting somethign null and saving
orr maybe visual studio doesnt seem to be able to update my config (cause thats what im using to view the config) ill try using a notepad
to open the config
nope still noithing
if the config is correct in the jar but not on the server, its your code breaking it
should i send the code?
the only thing you should be doing with your config at startup is saveDefaultConfig();
public void reload(){
reloadConfig();
badwords = getConfig().getStringList("badwords");
}```
```java
} else if (command.getName().equalsIgnoreCase("cplus")) {
Player p = (Player) sender;
if (p.hasPermission("cplus.reload")) {
reload();
p.sendMessage(ChatColor.GREEN + "Reloaded the messages of ChatterPlus");
}```
in the reload method i used that badwords thing to refresh a list too
deadass was about to post some long ass complicated function asking "Why is distance between always 0" 
why all the atomic references
async pathfinder stuff IDE kept bitching at me and i was lazy
cause variables changed inside lambdas need to be atomic/final
atomic bomb
good idea
the npc will build a bomb underneath the players bed location
and on right click the NPC till run to the tnt and light it
I need help with loading a structure in a location can anyone please help me
with schematics?
ask a specific question
very broad question
I just couldn't understand how it works
do I need to approach the StructureBlock class, structuremanager?, Structure
its so confusing
StructureManager holds all loaded Strructures
You either use a loaded one, or you load one, OR you create one
Its probably easier if you tell us what you are trying to do
b r u h
requireNonNull does not stop things being null
k lol
Pointless unless its in a unit test, just makes your code blow up earlier java public static <T> T requireNonNull(T obj) { if (obj == null) throw new NullPointerException(); return obj; }
im trying to switch an arena by using structures
sry for ping
gonna do try & catch
did you save teh arena?
as Structures?
yes
just use schematics
then they correctly exist in your world folder?
Structures are a part of Spigot now
no need for schematics
I guess, I mean it lets me load it from the game
so what issue are you having?
You get the Structure from the StructureManager and Structure#place
so does structuremanager#loadStructure is correct?
You did just say you can load them
Yes you use load to load it/fetch it if already loaded
Hey, I want to prevent ladders from falling off the wall when the attached block breaks.
For this I tried the following code. The sout is also output to the console, but the blocks break despite the event.setCancelled(true);.
@EventHandler
public void onPhysic(BlockPhysicsEvent event) {
if (event.getBlock().getType() == Material.LADDER) {
event.setCancelled(true);
System.out.println(event.getBlock());
}
}
Would anyone have an idea where the error could be?
physics is not a break
so I do load, it returns a structure, and then I do place to the structure
Oh you mean the ladder breaks
yeah
I've not attempted to cancel a physic event to stop a break.
generally you fake the supported block breaking
is that correct?
manager.loadStructure(new File("world/generated/minecraft/structures/structure.nbt"))
how to set the speed of a minecart?
not max speed, the speed its actually moved
you could easier do java StructureManager#loadStructure(new NamespacedKey("minecraft", "structure"));
so long as you saved it with the name structure
i love intellij's "block" selection or whatever it's called
Mmmm doing this in vsc makes me happy too lol
It's so satisfying
yeah I wish every application would have this D:
ALT+SHIFT+A in eclipse
How can I summon an Iron Ingot? I#m trying to make a Dropper for a Bedwars game
World#dropItem
It gives this Error: The method dropItem(Location, ItemStack) in the type World is not applicable for the arguments (Location, Material)
I typed: w.dropItem(Grau, Material.IRON_INGOT);
w is: World w = p.getWorld();
Look at the error and what do you think it means?
but, how can I make it different?
It tellsl you what its expecting and what you provided
I tried creating an Itemstack and it didn't work
it wants an ItemStack and you gave it a Material
yeah, but how do I create an Itemstack, which isn't a Material?
Or better said, how even do I create a ItemStack how I need it
new ItemStack...
Maybe your looking for fabric api or forge api for this project xD
doesn't work, error: The constructor ItemStack(Material, int) is undefined
either i forgot how bukkit works or your depending on a non spigot jar
Problems
- You have no idea what your doing
- You likely imported the api incorrectly
1 Is the biggest issue imo
?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.
I imported: import net.minecraft.server.v1_8_R1.ItemStack;
xD lmfao
yeah thats NMS
This means he added the jar to his project instead if maven or gradlew
?1.8
Too old! (Click the link to get the exact time)
You need to use the actual maven/gradle import for spigot api
server jar is not rly something you use
even for nms, we have remapped now
I thought because it said Inventory, its just for giving Players the Items...
I mean
you can
but its gonna be like
50 lines of code to do
vs 2 lines with bukkit api
oh
anyways, thank you both!
if you want an easy setup and use IntelliJ, lookup the minecraft development plugin for intellij
Then, new project -> minecraft tab
Will auto generate a blank template project for you
I have now worked out the following method to solve the above problem. However, the server hangs as a result.
@EventHandler
public void onPhysic(BlockPhysicsEvent event) {
if (event.getBlock().getType() == Material.LADDER) {
BlockFace facing = ((CraftLadder) event.getBlock().getBlockData()).getFacing();
Bukkit.getScheduler().runTaskLater(Main.getMain(), () -> {
event.getBlock().setType(Material.LADDER);
CraftLadder blockData = (CraftLadder) event.getBlock().getBlockData();
blockData.setFacing(facing);
event.getBlock().setBlockData(blockData);
}, 1);
}
}
hmm, can I avoid this somehow?
event.getBlock().setType(Material.LADDER, false)
also for event.getBlock().setBlockData(blockData, false); ?
yes
It worked, thank you
List loclist = pl.getConfig().getList("llist"); is this how I use something from another class?
No thats getting data from a ConfigFile
oh
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
If pl is a reference to your plugin class
^ Yeah you are referancing the getConfig() method of your main class doing that, forgot
so its Correct then?
private Main pl; this is pl
and this is the import of Main: import de.bedwars.main.Main;
But list gets this error: List is a raw type. References to generic type List<E> should be parameterized
Elgarl I still need help with the structure thing
structure.place(new Location(world, -18, -12, 40), false, StructureRotation.NONE, Mirror.NONE, 0, 0, new Random());
for some reason it does not load the structure
How can I get the first line of the item lore?
first check if the ItemMeta has lore, then get the lore with the index at 0
iirc ItemMeta#hasLore is a method
alright then I did right, thanks
Do you have anything in your structure? How did you make it?
well
the structure spawns on a build
maybe thats the problem?
like
one structure is the arena but with barriers
and one is without
so I want to swich the one with the barriers by the one without
nvm
it worked
lol
yo anyone can help me add multiple version support?
How can I load a world for uhc?
depends what you need
so I made a 1.16.5 plugin but I want 2 add 1.8.8 version support
how do I do dat?
Hey, any idea why my config.yml is cut in half after putting the plugin on my server? (If i open the jar file using zip, the config.yml inside it is correct)
go to pom.xml and replace 1.16.5 at the bottom (in dependencies) with 1.8.8
?paste your config.yml
I would do that but THE PLUGIN NEEDS TO BE 1.16
AHHH
but like it has a part of code that doesn't work on 1.8.8?
cause in simple plugins setting 1.8.8 will make the plugin work from 1.8.8 to 1.19.1
how?
that's how it works
I mean
unless you have a part of code that was invented in future versions of Minecraft
wait
I do
pom.xml
scroll down
add the repository below the spigotmc-repo
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository> ```
and also wait
then go to dependencies at the bottom of pom.xml
and replace 1.16.5 with 1.8.8
and then if you use IntelliJ IDEA then right click the pom.xml file -> maven -> reload project
hey for some reason this is not working: p.getItemInHand().getItemMeta().getLore().set(0, "test"); does anyone have an idea why?
Umm I will in around half an hour
butt
the plugin
needs
to be 1.16!!
If it NEEDS to be 1.16 you can;t support 1.8
NOOOOOOOOOOOOOOOOO
getItemMeta returns a copy, u need to assign it to a variable and then call setItemMeta after
I'm already disgusted by myself for still supporting 1.14.1+ in some plugins
like
var itemMeta = item.getItemMeta();
/** does stuff */
item.setItemMeta(itemMeta);```
it only needs to if it throws errors after setting an old version, but if you set an old version and it doesn't throw any errors IT WILL WORK FOR BOTH 1.8 AND 1.16
old version in this message means 1.8
so does it throw an error after you set the dependency to 1.8?
lol this is so stupid
then you cannot use ANY features that are 1.9 or newer
you couldnt check for offhand
cant use the PDC
can't use BlockDropItemEvent
p.getItemInHand().getLore().set(0, "test"); Didn't work either
yea I'm just telling him how it works with SIMPLE plugins
hm ill try
got it, ty
not sure if u need to call like getLore/setLore also to change it but that might also be a requirement
its long so it has to be a file since no more nitro no more character limit bypass
it only saves the messages after loading the plugin
?paste thats what this is for <-
now show me the broken config
have you tried it without the double line break?
yea
we'll need to see some code then, as just those files theres no reason for it to be cut off
its multiple entries
god classes. I remember everyone used to write them
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
oh its not paste.md-5 anymore
magic
line 165, is not a good idea, you are accessing the config at instantiation before teh plugin is loaded
set it null there
and set it from teh config after you saveDefaultConfg() in onEnable
thx ill try that
but there is also a chance that i magically did something or it is just a visual bug rn because the config appears full, im currently launching the server
wtf is wrong with this shit, i tried relaunching the server for the 18th time and now it magically generated the right config, one thing is wrong though
basically on the bottom of my code there is the playerchatasync event
its supposed to change the format of the message
it doesnt
nvm i forgot to do an if placeholderapi is null
imagine using multible classes-
well probably because you have FIVE events
ye lol who does that hehe
yea possibly
i mean its a chat managing plugin
im the only one-
one event is all you shoudl use here
no were together in this club
Or at different priorities
Yet i still rename apis to StuffManager instead of StuffAPI
alright ill change that, thx
set teh format early, then do chat later
so i should set the priority higher?
set format at Highest
thank you!
is there anywhere on the server that i can ask people to help me make plugin cause solo dev is overrated
oh yeah duh
or i can friend you cause your making a chat formatting plugin-
that was a question
im not just making a chat formatting plugin, mostly a whole chat managing plugin
well i could use chat skills cause im horrible with that
just friend me cause i cant friend you
umm so i didnt do the priorities yet, but i used the reload command which u can see in the code i sent, and it absolutely removed the chat formatting
any idea why?
in case you want people to contribute to your project, you need a project people can contribute to
and it have to be a cool project
well i have one\
dont know where to share it though
github
general, verified, here
oh
Well, i'd greatly be thankful if any of y'all contributed to a new plugin called horizon essentials, its just better essentials. and its SO damn buggy and i need help lol https://github.com/horizonstudiosmc/horizonessentials
epic
i needa fix bstats lol
i mean why would anyone need a second essentials though
or is it supposed to be a better version of it?
"better"
that's why I said "supposed to be"
bump
it has a total of 2 commands and is full of bugs
how is it better
"better"
btw isnt uploading things to github making it easier for people to copy your project?
Your project has to be worth copying
Yep
oh yeah makes sense
i mean you still can copy anything by opening .jar as .zip
Wait so everytime a player gets attacked it spawns a new scheduled executor?
Why not just have one main scheduled thread and store the combat time end in the hashmap
why not use maven
gradle > maven
idk i rather use maven
I just added combat tagging
Haven't tested it for multiple players
And The request method check doesn't work
gradle is maven on drugs. It's faster at compiling, but at what price?
btw you know making better essentials is probably gonna take you or anyone a lifetime which equals death?
It spawns a thread whenever someone attacks
That's pretty bad
Also the taskid gets overwritten so it won't even work properly
OOP was a mistake 
That's why I need more people
Or just do the same as the madlad yesterday and use ANT
https://www.toptal.com/developers/hastebin/husinasuxa.java
why after using the reload command built-in my plugin the chat formatting no more works?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
currently it sounds more like a "i need people to do it for me"
^
yea
If you want people to contribute to a All Rights Reserved plugin you're going to need to do a bit more work
and to do better
and not just say better
Ima clean up my abuse firat
Wait. How
within github
Want me to PR a license lmfao
bump again
just made a very useful PR
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
basically it gets back to vanilla chat formatting
so now i realised it only stops working after i actually change the formatting
Best way to avoid a entity from going into a certain area?
Might need NMS for that not sure
https://pastebin.com/RJTjM4Mu im having an issue with my potions. The Material.valueOf(item) does returns the correct enumwhich is POTION but after setting its itemMeta im getting a SplashPotion. someone knows what im doing wrong here?
Pastebin
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.
Have you tried logging and seeing what's printing?
yea and so far so good but ill add some more sout's hold on
this line might be the issue
boolean isSplash = config.isBoolean(dataPath + ".splash");
isBoolean checks if the path is a boolean and in your case it always is
inject into pathfinders
Oh dang i didn't notice that one! Big thanks. works heh
Anyone know a good way to edit the crafting recipe for an item?
E.g replace the iron ingots in an iron pickaxe recipe to like maybe another item
I'm currently getting the recipe with this List<Recipe> recipe = getServer().getRecipesFor(new ItemStack(Material.IRON_PICKAXE)); but I don't know how to read the recipe
So I would have to modify every pathfinding goal to make sure they avoid this area?
you can just modify the navigation
I did it in 1.18.1 to make sure zombies don't go through client-sided blocks
they can still get pushed through but not pathfind through
Sure, but you can just disable pushing. I'm writing this plugin for 1.17. If you don't mind, I'm on a bit of a time limit, could you send the code that you made? If you don't want to, I'll figure something out.
I already have a solution for that, bit of a ugly one, but it just teleports the entity to the nearest "allowed" place.
I'm thinking of overriding the move method
Also my solution uses mojmappings
I have a version without (before I turned to mojmappings) that you could use
But it's for 1.18.1
¯_(ツ)_/¯
Shouldn't be that hard to translate to 1.17, if you could sent it as well, it would be greatly appreciated!
here's how you inject it
Here's the obfuscated version
It's quite simple honestly
Just look at PathfinderNormal
copy everything
and modify that 1 static method with the 200 if(...) return PathType...
uh oh
comments are a great thing too
Hashmap Player player
HashTable<Player, Player, Player>
dunno how that works
https://pastebin.com/rp3S3ywb
https://pastebin.com/nB09xDfj
If i change something in the chat format in config.yml, and use /cplus to reload the file, the chat format gets taken back to the vanilla one (before changing it it worked), but if i change anything else and i dont change the chat format everything works fine, any help?
Pastebin
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.
Pastebin
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.
and i have a HUGE mess in my main class
cause i really dont care about the looks i just care if it works xD
i see lmao wtf
ye ill probably spend some time making something for the looks
😵💫
?
You are still doing List<String> badwords = getConfig().getStringList("badwords");
change it to List<String> badwords = null;Then in your onEnable, after saveDefaultConfig() add reload();
am i dumb or smthn my ide is saying ``` if (Material.valueOf(args[0].toUpperCase()) != null) {
}``` will always be true im trying to check if a materival exists
yea but pretty sure thats not gonna fix my problem with chat formatting
if it cannot be found its gonna throw an exception
yeah and i dont rly want that
You never know. you accessing a config which doesn;t yet exist can do all sorts of crap to your plugin
but that thing isnt gonna break anythingright?
Yes it might
noice
You are forcing Bukkit to deal with yoru config before its supposedx to. Before you've even asked for it to be saved
but im asking if what you told me with that code earlier is gonna break anything?
cause like if its null then the antibadword system might not work
no, my code will not break anything
alright thx
by calling reload() in your onEnable you set your badwords field
how to make a mob look at the player?
so umm it actually works with changing most things so thank you, but if i put a PAPI placeholder anywhere it throws this
i have papi installed of course xD
and also formatting doesnt work too
It says line 241
e.setFormat
nvm
in intellij it doesnt exist
bruh
okay i refreshed intellij now it works
so yeah it is the e.setFormat
intelliji is wierd
Your error is p.getDisplayName()).replace("%message%", msg)
nope, ignore me
I read wrong bracket
better than eclipse imo though
ofc
Ok I'm in the mniddle of cooking dinner, but your mistake is you are replacing the whole format, as if you are creating the output string.
You need to modify the format not replace it. there are elements you have to preserve in the original string
If I have an item with an NBT can I make a recipe use the whole item rather than only the material?
So like if I have stone with a PDC key of "eee" can I make a recipe use only stone with the PDC key of "eee" rather than just plain stone
What does that mean? (sry i dont understand much xD), you can respond after dinner ofc
.
it throws errors when using placeholders in chat format in config.yml
from the looks of this i dont think so https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ShapedRecipe.html
declaration: package: org.bukkit.inventory, class: ShapedRecipe
I thought namespacedkeys auto lowercased everything?
help please
No, they’re more like validations
When you have a NamespacedKey you can rest assured the content encapsulated follows a pattern
mhm, I have caps in some of my namespaced keys, but this one just gave me an error I was just confused.
What mob specifically?
cave spider
doesnt it look at the player when it attacks him?
I have question for registering a custom command class with a custom annotation processor do i need to initialize the class?
Its a question which ill be used on my command framework
A class is always initialized when the classloader touches it...
Oh ok
But you will obviously have to instantiate it nonetheless.
That was what i mean
If when using reflections for registering them i need to initialize
Then i have a big issue because i need to care about the constructors from the command classes
🤔
Anybody know a good player point based api
Dm me and explain exactly what you need
Maybe i can do a custom for you (free or as you want)
👍
on a EntityDamageEvent is event.getEntity() the one who was damaged or the one doing the damage?
OK I'm back. Your issues is you are replacing the whole format with a single string, including the message. Spigot is expecting a valid format string not just a string
do not insert the message into the string. modify it and use setMessage
then at the end of the format string add %s or perhaps it %2s I forget
setMessage wouldn't change the format of the nickname surroundings, or am i not understanding correctly?
no, but you are modifying the message to remove links etc?
yea
ohh I understand, thank you!
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlexPvP.get(), () -> {
if (event.getProjectile().isOnGround() || event.getProjectile().isDead()) Bukkit.getScheduler().cancelTask(finaltask);
player.sendMessage("flying");
}, 0L, 1L );``` would anyone know why the task still gets repeated after the arrow hit the ground?
because the event is stale once you enter your runnable. itsd not dynamically updated
You can get teh shooter in that event
Anyone know a good player point (coins) based api?
What I would do I would first create a instance like so BukkitTask task; then do your code, then I would simply do task.cancel();
Or don't use a runnable at all as you don't need it
@EventHandler
private void onProjectile(EntityShootBowEvent event) {
if (event.getEntity() instanceof Player player) {
var data = PlexPvP.getPlayerController().get(player);
var selectedCosmetic = data.getSelectedCosmetic().get(CosmeticType.PROJECTILE);
if (selectedCosmetic == null) return;
var task = 0;
var finaltask = task;
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlexPvP.get(), () -> {
if (projectile.contains(event.getProjectile())) {
Bukkit.getScheduler().cancelTask(finaltask);
projectile.remove(event.getProjectile());
}
player.sendMessage("flying");
if (!activeProjectiles.contains(player)) {
player.sendMessage("avail");
switch (selectedCosmetic) {
case RAINBOW -> Rainbow.play(event.getProjectile(), player, activeProjectiles);
}
activeProjectiles.add(player);
}
}, 0L, 1L );
}
}
@EventHandler
private void onProjectileHit(ProjectileHitEvent event) {
if (event.getEntity() instanceof Player player) {
var data = PlexPvP.getPlayerController().get(player);
var selectedCosmetic = data.getSelectedCosmetic().get(CosmeticType.PROJECTILE);
if (selectedCosmetic == null) return;
projectile.add(event.getEntity());
}
}```
this doesnt seem to work
you are trying to add a rainbow effect to an arrow?
getEntity() is the projectile not the player
it will never be instanceof Player
event.getEntity().getShooter()
well the event is going to be a general thing
can play one of many kinds of effects
bungeecord is a proxy. You can just run it on a raspberry pi if you want.
So it only job is to redirect right? Like no traffic is actually running through it other then the players connecting?
Same goes for spigot. Everything that runs java can run bungeecord and spigot.
So all pcs, servers, pis and even your smartphone.
The whole traffic is going through the proxy. Every single packet.
Thats what a proxy is for...
So it will bottleneck if my proxy ain't as good as my game servers?
No. It will bottleneck when it can not handle the traffic. Either through bandwidth or cpu limitations.
is there a way to make sure this error doesn't happen?
Error: SQLITE_BUSY: database is locked
Most probably
what?
you said it before i sent it
Use a connection pool like HikariCP. You are probably polluting your connections.
i dont understand
And make sure to always properly close your connections.
its a bot. it should remain open
No. Always close your connections after you used them.
If you need something else then you create a new connection.
Usually all of this is done by a connection pool.
Like HikariCP
ok
Is there any good ScoreboardAPI out there. cant seem to find
The Spigot Scoreboard API is quite good. I'd use that
-.-
🙂
Agreed
But it wil only receive traffic the moment a user connects?
It will also handle any pings and handshakes. But the main traffic occurs while players are connected.
is there some sort of entity collision event
no
Nope
But it's not responsible for the minecraft traffic
damn
i need to make a certain mob not collide with any entities in the world
i'll just use teams then
Yes its responsible for the whole traffic. If a player moves a bit then he sends a packet to the proxy and the proxy sends it to the server.
If a block changes on the server then the server sends a packet to the proxy and the proxy sends it to the player.
And for every player the proxy will have to route thousands upon thousands of packets every single second.
Mob is a LivingEntity which has a setCollidable
I keep getting a null exception error for my ARMOR hashmap not having anything in it, but when the plugin starts I have a loop for when online players first join everything gets set, Max Mana 100, Mana regen 0.5, setting Mana to 0.0, that all works but when i set Armor to 0.0 im still getting null exception.
java.lang.NullPointerException: Cannot invoke "java.lang.Double.doubleValue()" because "original" is null
// where the error is happening
public static void addArmor(Player player, Double amount){
Double original = ARMOR.get(player);
Double now = original + amount;
ARMOR.put(player, now);
}
// Puttnig the player in the hashmap
for(Player player : Bukkit.getServer().getOnlinePlayers()){
Mana.ARCANE_POWER.put(player, Mana.MAX_ArcanePower.get(player));
player.setHealth(40);
player.setSaturation(20);
player.setFoodLevel(20);
Mana.MANA_PER_SECOND.put(player, 0.5);
Mana.MAX_ArcanePower.put(player, 100.0);
Armor.ARMOR.put(player, 0.0);
}
I don't know what to fix..
Well ARMOR.get(player) returns null. Problem solved.
yes but im setting the armor
Armor.ARMOR.put(player, 0.0);
when the player joins
it shouldn't be null
The Player object does not get reused if a player relogs
There is SO much wrong with this code. Im not even going to attempt helping here to be honest.
You should visit the java basics again or at least take a look at conventions.
all.addPotionEffect((new PotionEffect(PotionEffectType.WEAKNESS, 255000000, 10, true))); Is the true for removing particles?
declaration: package: org.bukkit.potion, class: PotionEffect
So does the proxy have to be beefy?
Short question. Is there a way to get any player? I just need it to initialize something when starting my plugin, but I'm not sure what player to use, especially because names change
Really depends on your traffic. But if you get a decent root server for 20 bucks (i7 4770 or something) then you can run
8 minecraft server + your proxy on it without any problems.
<20 players it does really not matter.
nvm im stupid
got it
I have an ryzen 9 server with 8gb which I intend to use as a hub for around 100 players. Could I use a xeon with 1 gig for proxy or will I bottleneck like shit
I'm trying to implement proximity chat:
https://mystb.in/TabletsWichitaCompilation.csharp
For some reason it errors when a player sends a message in chat without any description
What kind of xeon. There are xeons from 10 years ago that would bottleneck.
Are you loading data from a database every time someone writes in chat?
yeah
AsyncPlayerChatEvent is not assured to run async. This can be a huge lag machine.
damn
?data
It's an Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
well I'll just cache everything in ram then
anyways i don't see how it would cause it to error
Well the error is as clear as it gets.
oh wait
"IllegalStateException: Asynchronous getNearbyEntities!"
can I not use getNearbyEntities on an async thread
is there some sort of workaround
ofc not. You can not use any spigot api from another thread. Nothing.
?datamanagement
Ah thx
@ornate patio
Think about when to load your data.
thanks
Yw:)
?
Just do it on the main thread?
does Bukkit.getScheduler().runTask work
Sure
Does anybody know how to change block strength without NMS, i just discovered this server and after 2 weeks i am pretty sure its impossible but if it is, can any of you help
Is it efficient to load player data to memory on asyncplayerpreloginevent, and then edit the data in memory then save back to database on quit or server close async, but always keep a copy in memory so if they relog it’s already there
Only synthetically with events. Otherwise you would need to change the blast resistance (or "durability") through nms
I dont know nms though, Whenever i try to use it, it always errors. I dont know how to import it cause im using InteliJ and I have been struggling for 2 weeks with this.
Thats what you should always do.
On prelogin -> load data
On quit -> save data
I would not keep it in memory after a player logs off.
Allot of the time I get CraftMagicNumbers but not even that works.
Alright thank you, I kept it in memory just so I didn’t have to read it back from the database if they relogged
This will be a huge problem if you have several server instances. Otherwise its fine.
i was honestly planning to load data from the database every time a player takes damage 💀
Dam bro
Why? Read the article and then define your "sessions"
SQL or MariaDB which is better
I'll have a class to automatically manage all the data in the background
No need to set up anything. Just understand the "states of data" and the "scopes of data"
alright
is it possible to get the head location of an entity?
getEyeLocation()
if not, does anyone know how high the middle of a player's head is in relation to the bottom of their feet
ah ok ty
@lost matrix How would I go about creating this data manager for two linked data types
I have to store a bunch of Families that contain a bunch of players
in my SQL database I have a separate table for players and families
Every family should have a uuid.
Then in the player data you set the family uid
in the family you maintain a set<uuid> for all family members
"in the family you maintain a set<uuid> for all family members"
But aren't I also storing a family id in each player?
So i'll have make sure the player references the family and the family references the player?
Depends on your model and what relations you want.
well I am going to be accessing members of a family and the family of a player quite often
Anyone who has or knows about an easy to use ScoreboardAPI
By chance do you happen to know if theres NMS methods for making a Player place a block thats in there hand? Or would packets be the only way?
is listening to an event from a different plugin the same as a bukkit event?
Yes
I've got a SchedualedExecutorService, which schedules 3 runnables at fixed rate:
Main.getScheduledPool().scheduleAtFixedRate(new ServerConnectionWorker(),0,100,TimeUnit.MILLISECONDS);
Main.getScheduledPool().scheduleAtFixedRate(new DataUpdateWorker(),0,500, TimeUnit.MILLISECONDS);
Main.getScheduledPool().scheduleAtFixedRate(new HeartbeatWorker(),0,2000, TimeUnit.MILLISECONDS);
But for some reason I don't understand, the second task (DataUpdateWorker) only executes one time.
how does the class look like
It would be possible to build .jar file with icon?
public class DataUpdateWorker implements Runnable {
@Override
public void run() {
System.out.println("TEST " + Main.getServerManagerConnection().isConnectionConfirmed());
try {
if (Main.getServerManagerConnection().isConnectionConfirmed()){
MCServer mcServer = new MCServer(Main.getServerManagerConnection().getUuid(), (BufferedImage) Bukkit.getServerIcon());
Main.getServerManagerConnection().getMCManagerConnection().write(Requests.Common.updateData(mcServer));
System.out.println("SENT " + Main.getServerManagerConnection().isConnectionConfirmed());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}```
What do you mean?
how do u instantiate it
Executors.BLAH_BLah
which one do you use
then u should delegate
to a pool with multiple threads
(which is usually what we do)
private static final ScheduledExecutorService scheduledPool = Executors.newScheduledThreadPool(3);
work stealing 
ngl cached prolly better for mc maybe
just a few threads open, doubt theyre gonna be constantly used to where they all get taken up
#ProjectLOOM
So what can be my problem?
wtf is that
you just need to change your service pool
To what?
I could imagine one of ur tasks comprises to a dead lock
basically a JEP that adds virtual threads and more threading shit
to java
which means scheduling gets blocked entirely
hence why we usually wanna execute logic in another pool
I also like project panama
Executers has a few different methods
You can used a fixed sized cached pool
Or work stealing to a fixed size
The method names are quite literally named those
Typically you size them to System.getRuntime().theCoreCountMethodHere() (Someone know the name)
Or just let them size themself with the default () args
oops
meant to reply
so its a hack for jdk1k 19
in a sense
@manic furnace
OH CONCLURE
you could try to obtain the thread
HAVE YOU MET LEEROY
Wyf lol
loom is a feature?
bump in case anyone knows
never heard of jeps
lol
and then objects with objects, that also have another object
with another 40 methods
can hear my computer scream rendering the tab completions for ServerPlayer
they'll make you wish for them instantly
anyone has an idea of how to create a line of particules (x blocks long) and detect if it touches a player, and then get that player?
var scheduler = Executors.newSingleScheduledExecutor();
var tempExecutor = Executor.newCachedThreadPool(runnable -> {
var thread = new Thread(runnable);
thread.setDaemon(true);
thread.start();
});
Executor executor = runnable -> {
try {
tempExecutor.submit(runnable);
} catch (Exception e) {
//HANDLE
}
};
Consumer<Runnable> = runnable -> scheduler.scheduleAtFixedRate(() -> executor.submit(runnable),delay,timeUnit);
you probably wanna have something like this
or well
oh wtf
wait let me think
hmm
nmsPlayer.connection.send(Packet, () -> { // listener}) 😐
Since always?
never seen em before
JScoreboards
I'm working with NBT API and am re-developing a plugin one of my friends made, but #getPersistentDataContainer() doesn't work with 1.8 (the version I'm developing in). What is the alternative to the method? How does getPersistentDataContainer() work?
public static int getMaxHealth(Entity e){
NBTCompound target = (new NBTEntity(e)).getPersistentDataContainer();
return target.getInteger("maxHealth");
}
public static int getHealth(Entity e){
NBTCompound target = (new NBTEntity(e)).getPersistentDataContainer();
return target.getInteger("cHealth");
}
...
It was added in 1.14
https://www.spigotmc.org/threads/a-guide-to-1-14-persistentdataholder-api.371200/ explains what a persistent data container is
^
and is a Bukkit method, so I'm not entirely certain why you're retuning an NBTCompound, which is NMS
Not to mention... the methods you linked literally have Bukkit alternatives of LivingEntity#getHealth() and #getMaxHealth()
Thanks.
here is a api https://www.spigotmc.org/resources/nbt-api.7939/ for 1.8.8. Next time just use google
Okay. Thanks for the help
chooocoooo
Yes Jscoreboards but I cant seem to get the injection right
dependency is just red all over
I'm using that API actually, but this error is still thrown when hitting other entities since the method isn't available for 1.8.8 (which is why I asked the question about alternative options).
Caused by: de.tr7zw.nbtapi.NbtApiException: [Selfchecked]The Method 'getPersistentDataContainer' is only avaliable for the Versions MC1_14_R1+, but still got called!
I'll figure out an alternative though.
Your using NBTApi right
Yeah
Yeah so I could add a check if the version is 1.14 or less
and you can
MinecraftVersion.getCurrentVersion() >= 1_14_0
your better off double checking you have all the info right then going to the dependency owner to make sure things are working out on their end
but do you see anything wrong?
I'll probably do that. Thanks 👍 This seems to work so I could prob change the code based on the version
public static int getMaxHealth(Entity e){
int target = (new NBTEntity(e)).getInteger("maxHealth");
return target;
}
nope looks like proper syntax to me
you added theyre repo right if they have one and refreshed maven?
yes i added repo
that looks fine
indeed it even exists in that repo
odd
well, for now you can install it to your local maven repo if you have the jar
no jar :<
do you have a scoreboard api?
omg
haha
dang I got banned from csgo
Dum
I did it on purpose I didn't really care anymore
did it work?
weird, how?
it just say dependency ... not found
oh I had The same thing happen when I tried importing craftbukkit into my maven
try lowering the version
lowering the version is a horrible way to do it
He likely has something wrong with his maven cache, thats not allowing it to import correct
Yanesa are you 100% sure you refreshed maven
When you import a new lib a button shows up here in the top right
ofc ofc
I'm trying to create a timer that counts down from 15 minutes, but timeLeft always counts down in increments of 2 and starts at 14:99 which doesn't make sense.
BigDecimal timeLeft = new BigDecimal((double)timer / 60).setScale(2, RoundingMode.HALF_UP);
String line0 = "§bTime Left: §7" + (timeLeft.toString().replace(".", ":"));
team1.setBoard("Title or whatever", line0);
team2.setBoard("Title or whatever", line0);
?jds 1.19
I would suggest using a timestamp
^
Also Instant provides a bunch of timing methods for you
99% sure it handles epoch milli to formatting like you do
public class Cooldown {
private long end;
public Cooldown(Long time) {
this.end = System.currentTimeMillis() + time;
}
public void stop() { this.end = 0; }
public boolean hasExpired() { return (System.currentTimeMillis() - this.end >= 1L); }
public long getRemaining() { return this.end - System.currentTimeMillis(); }
}```
version?
😂
hahhaa
No you are
fuuuuck no
I will defend 1.8 users with all my energy
Too old! (Click the link to get the exact time)
?1.17
Install 1.17 with BuildTools: https://www.spigotmc.org/wiki/buildtools/
WAIT
Thanks!
1.8 almost 7 years old
Not much, cobol is like 20y olds and still being used so please close your esphinter
Sorry if sound rude
But i will always defend 1.8 servers
🤙
If need something else just ask it here
have you used JScoreboard before?
Look my dm bro
I told you to use assemble
but
why 1.8 when 1.19 exist
Same shit with cobol bruh
Why cobol exists, if there is python, rust, etc
😂
thats a programming language
not a game tho
cobol can actuall have very valid use cases irl
java is shit, 25?
but that doesnt mean people use java 3 still
same with cobol, when people use it im sure they use the latest developed version vs the older one with bugs, security flaws, developmental mountains for code style, etc
Hmn i dont know dont worry
If i do a command annot proccessor do i need to care about class constructor when doing initialization?
uhm
so what i do, is provide dependency injection for my command class annotations
or, if its empty/no constructor just pass an empty when calling the new instance reflection method
doesnt rly matter for constructor
java provides one by default if none exist and you try to initialize it
Wait
My command handler class looks for classes annotated with @Command, and then saved each name and data
But what about if the class have a constructor, there i cannot initialize...?
as long as its public you can use reflection to initialize it (I assume your using reflection to register these annotation classes)
Yeah
i can show you the code i use sec
But i wont know the constructors param so then i cannot initialize
yes you can if you want to provide dependency injection



