#development
1 messages Β· Page 131 of 1

May I suggest our lord and savior IntelliJ IDEA by JetBrains
I mean, I've tried, a few times. But I can't be be bothered learn a new IDE and fix a theme and those things again.
its easier in the long run though
It took me 15 mins to figure out how to export a .jar. And I didn't succeed lol
a short term struggle to fix all pontential issues in the long run
yeah that's why build tools like maven and gradle exist, to make that process not depend on the IDE
I mean, I wish I would have gone with it from the get go. But, yeah, I can't really be bothered xD It works good, except for when it does these kinds of things to me
Might give it another try
But we'll see

how does the package structure work? do you have
src/
main/
java/
org.myapp/
loggers/
utils/
test/
java/
org.myapp/
misctests/
and what about in src/main/resources and src/test/resources?
Thats how it is
Just the org.myapp being nested folders too
so i can't have conflicting packages in src/test and src/main?
Wat
they're asking if they can have the same package in test as in main
as in i couldnt have src/main/java/org.myapp/utils and src/test/java/org.myapp/utils
so for example
src/main/java/org/myapp/loggers
and
src/test/java/org/myapp/loggers
or that
as they would both resolve to org.myapp.utils
should i not make a tests package inside src/test/java/org.myapp
uhhh really
yes you can
yes but say i want src/test/java/org.myapp/utils to be testing src/main/java/org.myapp/utils
you just cant define the same class twice, as if they were the same codebase
src/test/java
you can have the same class in the same package just different module?
or was that not for me
?
would it not make sense to have a tests wrapper package
ah i wrote it wrong
src -> main -> java -> some -> package
-> test -> java -> some -> package
``` this is possible. I know for sure. what I don't know if its possible to have the same classes in those packages tho
It's usually 1 : 1
main/java/myapp.package.classes.ClassName
test/java/myapp.package.classes.ClassNameTest
yeah but you can't have the exact same class right? That's what I'm saying
I know for test classes you usually want to append Test at the end
but I'm just asking
bcz I'm curious
and can't test rn
Yeah no they can't have the same fully qualified name
So i am trying to delete a row in sql with the following code:
public void removeReward(String reward, String playerUUID, String table) {
try {
PreparedStatement ps2 = plugin.SQL.getConnection().prepareStatement("DELETE REWARD FROM " + table + " WHERE UUID=?");
ps2.setString(1, reward);
ps2.setString(2, playerUUID);
ps2.executeUpdate();
return;
} catch (SQLException e) {
e.printStackTrace();
}
}```
But when i try this i get this error: https://paste.helpch.at/upocagames.md
The layout of the table is the following:
Anyone that has an idea how to fix it?
bruh
No need to shout.
delete from not delete reward from
same error
also you seem to be both concatenating the sql string (yikes) and using a prepared statement
do the latter for both
wait what
You only have one ? and you set the uuid as 2nd argument
Currently you are looking for an entry with UUID = reward, not playerUUID
How can I set a stairs facing direction?
in 1.8.8?
apparently
loc.getWorld().getBlockAt((int) x, (int) (y + 4), (int) z).setType(Material.QUARTZ_STAIRS);
Block stairs = loc.getWorld().getBlockAt((int) x, (int) (y + 4), (int) z);
Directional d = (Directional) stairs.getState().getData();
d.setFacingDirection(BlockFace.SOUTH);
stairs.getState().setData((MaterialData) d);``` doesnt work
getState returns a new snapshot of the block data each time you call it
you need to put it in a variable, modify it and then call BlockState#update() when you're done
ty, do you als know by any chance how i could remove a specific reward ?
loc.getWorld().getBlockAt((int) x, (int) (y + 4), (int) z).setType(Material.QUARTZ_STAIRS);
Block stairs = loc.getWorld().getBlockAt((int) x, (int) (y + 4), (int) z);
Directional d = (Directional) stairs.getState().getData();
d.setFacingDirection(BlockFace.WEST);
BlockState bs = stairs.getState();
bs.setData((MaterialData) d);
bs.update();``` @lyric gyro so this?
https://imgur.com/a/UYD367j Does anyone has idea why is this happening?
api-version only takes into account major.minor versions, so you would use "1.18" instead of "1.18.2"
now I gotta figure out how slabs work
and how to get them on the lower half of a block :)
ok thanks, ill try out
enjoy 1.8 
REMOVE FROM table WHERE column = ?, just like you did. Just use setString(1, playerUUID)
ty
any idea why i could be getting
Caused by: java.net.UnknownHostException: "127.0.0.1"
trying to connect to redis via jedis in java
redis.clients.jedis.exceptions.JedisConnectionException: Failed to create socket.
return new JedisPool(jedisPoolConfig,
redisData.get("address").toString(),
redisData.get("port").asInt(),
2000,
redisData.get("password").toString());
Anyone know if you can color a button in rich presence with a discord bot?
how hard would It be to make a plugin that allows a person to put multiple commands into a command block
i would also have to learn java for this as i only know c#
would need a mod for that btw
i think
the thing is with multiple commands in a command block is that it would require a custom GUI with multiple text inputs
so
a plugin can modify pretty much everything server-side
but it can also use CustomModelData to also use resource packs
i was thinking simpler than that where you can just separate them by &&
ah ic
oh then u can use a plugin
not sure how easy it'd be to move to java, but I know c# and java are very similar
thats what ive heard
wheres a good place to get started learning how to make plugins?
well
you might be able to look up a tutorial, I know spigotmc has a tutorial for it
as for the coding part, look up how to create a Listener
I think https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServerCommandEvent.html (ServerCommandEvent) should work
prob something like ```java
public class CommandListener extends Listener {
// [EventHandler]
@EventHandler // tells spigot that this is a listener method
private void onCommand(ServerCommandEvent event) {
if (!(event.getSender() instanceof BlockCommandSender)) {
// aka event.getSender().GetType() == typeOf(BlockCommandSender)
return;
}
List<String> commands = new ArrayList<String>();
// below: foreach (string command in event.getCommand().Split("&&"))
for (String command : event.getCommand().split("&&")) {
// loops through the command split by "&&"
commands.add(command.trim()); // remove any spaces around the command
}
if (commands.size < 2) {
return; // if there's only 1 command, just let it run normally
}
event.setCommand(commands.remove(0)); // set the command to the first command on the list
for (String command : commands) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); // to the rest of the commands, run them in console
}
}
}
something like that
hopefully it's similar enough that you can understand
added c# versions in comments
hey dkim
hi emily
uhhh sure π
oh-
yes
a conversation
oh
okay good
well you see
I didn't know what we were developing and so now I don't need help π
π
π₯³

πͺ
:Warning: :Warning: :Warning: :Warning: :Warning:
:Warning: :Warning: :Warning: :Warning: :Warning: :Warning: :Warning: :Warning: :Warning: :Warning: :Warning:
why aren't the emojis showing
Remove the space
from where lol
private inline fun <reified T> makeRequest(url: String, t: T?): T? {
val headers = org.springframework.http.HttpHeaders()
headers.contentType = MediaType.APPLICATION_JSON
headers.accept = Collections.singletonList(MediaType.APPLICATION_JSON)
headers.setBasicAuth("a", ACCESS_KEY)
val entity = HttpEntity<T>(headers)
return restTemplate.exchange("$BASE_URL/$url", HttpMethod.GET, entity, T::class.java).body
}```
thats making the request and then I call it with
val party = makeRequest("parties/$sisId".trim(), JobReadyParty(-1, "-1")) ?: return LocalDate.MIN```
Does the request contain a " "?
dont think so....
Can you use a debugger to see the exact request or sout?
Holy crap you really went the extra mile
Thanks
Can you recommend me some command manager library/framework ?
?mf
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOONβ’οΈ
Thank you!
do you need a specific java jdk for different minecraft versions or does the latest always work?
latest will always work, but you need java 8 at minimum
although i think paper requires java 11
^
hmmm
different plugins will also need newer java versions
my server runs on magma forge
deluxemenus also needs java 11 I believe
do those require 11 minimum or strictly 11
minimum
π
@Override
public void onEnable()
{
}
``` would this still be called a method in java
also ```
@Override
i get its an annotation but what does it do
alright i read about it and im still confused lmao
it's still called a method in java
The @Override overrides the function from the inherited class (JavaPlugin)
yeah i'm not sure how much detail you wanted
feel free to do more research on it, there are probably a ton of people that can explain it better than i can
no thats what I was looking for just a simple explanation and if i get confused with it later ill be able to ask a more specific question
Alright π
[23:56:48 ERROR]: Could not load 'plugins\Multi Commands.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/JohnZ/Multi/Command/MultiCommand has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[patched_1.12.2.jar:git-Paper-1620]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[patched_1.12.2.jar:git-Paper-1620]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[patched_1.12.2.jar:git-Paper-1620]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:318) ~[patched_1.12.2.jar:git-Paper-1620]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:222) ~[patched_1.12.2.jar:git-Paper-1620]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[patched_1.12.2.jar:git-Paper-1620]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_301]
Caused by: java.lang.UnsupportedClassVersionError: com/JohnZ/Multi/Command/MultiCommand has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 52.0
``` It seems theres some version incompatibility here
You compiled your plugin in a higher java version than your server runs, so your server can't run the code
awesome!
i'd recommend looking up your error messages on something like the spigot forums before taking them to this server because someone's probably had the same issue before
ya lmao but discord is just so easy
ill try to keep them off here though
but i do have a good question
public class CommandListener implements Listener {
@EventHandler
private void onCommand(ServerCommandEvent event) {
getServer().getConsoleSender().sendMessage(ChatColor.BLUE + "command is sent");
}
}
this code should send a message in the console every time a non player sends a command
but its not
what am i doing wrong here
did you register it in the config.yml
are you setting the command executor in the main class
are you sure that the plugin is enabled on your server
there are a lot of things that could be going wrong
alright, soujnds good
and boom
I did it!
multiple commands can go into a command block now
and I learned the basics of plugin development
alright so there is an issue with my plugin
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
i use this code
to run all the commands after the commandblock executes the first command
but the problem is that line sends the command through the console and I need both commands to be sent through the command block
because both the commands I need depend on locations
one is a setblock command
the other gives currency to the player closest to the command block
Is it possible to change how org.bukkit.command.Command#testPermission() works?
Using a plugin*
sounds like an xy problem to me
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
I am using this in maven to get acces to nms but whenever when i reload maven i get the error ``Cannot resolve org.spigotmc:spigot:1.18.1-R0.1-snapshot``
Have you add the repository?
Oh, you're trying to use NMS?
yeah
Have you run the build tools?
np
So, I would like to use an API of a plugin, but the repository and dependency is there only for Gradle. I tried to translate it to the maven, unfortunetly doesnt work. Can someone give me some advice about this topic please?
Check out this article: https://www.baeldung.com/gradle-build-to-maven-pom
Just split the dependency by : first is group id, then artifact id, then version
Mind sharing which dependency it is?
I am still looking for a solution to this
I am wondering if there a way to get the coordinates of where the command block executed the command from bc that might solve the issue
Also if there is a way to find the closest player to where the command was executed from
I could solve my issue with one of these
If I can find the coords I could also calculate the closest player
I don't think you can do this.
You need to define the location yourself.
EcoPlugins
I tried it, sadly doesnt work
You can cast the sender to BlockCommandSender if you're certain that the command was sent from a command block. You can ensure that it's sent by a command block by utilizing the instanceof feature, like this:
// if the sender was not a command block, don't continue
if (!(sender instanceof BlockCommandSender)) {
return;
}
final BlockCommandSender commandBlockSender = (BlockCommandSender) sender;
// do your thing here...
if I have an interface where I specify a variable like
interface MyLogger {
val redisPool: JedisPool
val loggerName: String
fun serialise(): String
fun updateRedis() {
redisPool.platform.use {
redis -> redis.set(loggerName, serialise())
}
}
}
and then in my class that implements my interface I do
public class BooleanLogger(override val loggerName, override val redisPool): MyLogger {
// ...
}```
however, when I pull an object from a Map<String, MyLogger> and try use the redisPool, I get null returned on the getter generated
despite initialising this logger with a non null value
I'm wondering if it's something to do with the override, or like it's still trying to get it from the interface or something
maybe it's because the method inside the interface is using it, but it's not declared until it's inside the class. is there a way around that?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/CommandBlock.html
try listening to the command send event and set a new command in the command block
declaration: package: org.bukkit.block, interface: CommandBlock
anywon
Someone answered you right under your message.
Why would you want to do that? What are you trying to do?
replace default permission message?
There's a config for that in paper.yml :P
no-permission: '&cI''m sorry, but you do not have permission to perform this command.
Please contact the server administrators if you believe that this is in error.'
Should be at the veeeeeery top
for newer versions of java (16+):
if (!(sender instanceof BlockCommandSender commandBlockSender)) return;
Hey can anyone help me with this, I am trying to run the "restart" command. But this kinda defeats the purpose of a restart command
remove pause from your start.bat
also #minecraft
or atleast i think thats the right place
might be #general-plugins actually
Okay
@kind granite The expansion has a few - at least for me - questionable design choices.
First: Optionals (Ewwwww). Really don't see a benefit over a simple if (something == null) check.
Second: the split.length >= 2 can be replaces with either split.length > 1 or split.length = 2 because your usage of params.split("_", 2) guarantees that the array won't be larger than 2.
Not sure how much better it would be in terms of performance, but maybe have the LocalExpansionManager instance cached or smth?
Like smth such as
private LocalExpansionManagarer expansionManager = null;
// All the other stuff
public String onRequest(final OfflinePlayer player, @NotNull String params) {
if (expansionManager == null) {
expansionManager = PlaceholderAPIPlugin.getInstance().getLocalExpansionManager();
}
// Check again for null? Idk for sure...
return // stuff
}
Also, I would return null when split is 1
Because PAPI doesn't allow %identifier% placeholders
Maybe like this? Idk... Just trying around a bit
why is using optional a questionable design choice? π€
Many people say it's a bad option performance wise
lol it's really not
Even Sponge devs had a huge debate about if they should remove it or not
JDA devs also mention it's bad
I don't think it should be used everywhere but it definitely does have its place
And they know their java
JDA is hot garbage
it allows for more expressive code instead of "oh I have to stop here and check for null" every two lines
and unless you're running some really hot code all the time, the performance impact is truly negligible anyway
like.. 99% of what one does in java already
Optional can be pretty nice in some places, other places not so much
Kotlin's null safety is one of the things they really nailed it well
It's not as intrusive as an Optional can be sometimes but it's also far from being as disgusting as null can be sometimes too
I honestly donβt mind nulls as long as methods are annotated properly
null safety chaining in kotlin is really nice
i've only really used optionals when its cleaner to chain with it and then fallback on a default
thing is that j.u.Opt is really.... poor, and is not really used in the jdk so there isn't even an incentive to use it
Scala's Option is embraced in the stdlib (and any other scala lib, lol) and it's feature packed (+ the way you can do some stuff in Scala makes it much pleasant to use than in java)
Dude omg thanks works like a charm now
why?
Error:
https://paste.helpch.at/upitorivum.bash
my main class:
https://paste.helpch.at/logalosoli.java
the class where I actually play with NMS:
https://paste.helpch.at/adidajogag.java
Do you use paperweight or md5's broken maven plugin?
Does java.io.Serializable need to be implemented in classes that are as a variable in another class that implements Serializable?
ex java public class Data implements Serializable { private OtherData other; }would OtherData have to also implement Serializable?
Why are you using Serializable?
helping someone else with data files and don't want to introduce importing a library and stuff
yes
"it depends"
yes it does
what do you think I said? chocolate?
yes
skull
Serializable is a good simple example (without libraries (besides the jdk)) that you can make data out of an object and the other way around, but a) it's not human readable data (it's just an array of bytes) and b) it's not a really good method for large things (that's why it's good for simple examples showing "hey you can do this" (though it also has its use cases but it's quite niche))
hm
But like then you can just throw gson and do the same thing anyway
true
and it'd be human readable
and without implementing serializable
throw the object into the serializer and it'll give you the thing
paperweight
sorry for late
What would be the best way to set up a folder called something like "classes" that contains an basically unlimited amount of yaml files, one file for every class
Is there some way of updating specific parts of a GUI using TriupmhGUI instead of clearing it and updating it all every time? It seems a bit bad performance-wise
Kinda confused why this would store the GUI every time I close it. Because when I reopen it, it says shows the lore one more time if that makes sense https://paste.helpch.at/itukadufin.cs
to update an item in the gui
iirc
you have to do gui#setItem and then gui#update
but just make sure you're not setting the same values every time
I suppose I could use updateItem? Just found it
might be worth looking into what updateItem does
as if you're doing bulk updates, it might update every single time, when in reality you could do all the setItems and then do one update
Hmm not sure what it does tbh, it seems like it keeps track of the guiItems for some reason?
looks like it has a copy of the gui and the actual inventory
this would be a good question for @pulsar ferry, whether doing a bunch of setItems then one update is better, or a bunch of updateItems. Possibly could be quite similar in terms of performance
I think just storing the GUI and then using gui.update() in the end would fix the issues, but yeah not sure about performance then
It still loads everything multiple times for some reason
that is quite weird
are you modifying the GuiItem?
I use this but that's really all ```java
public static void setItem(Gui gui, ItemStack item, int slot, GuiAction<InventoryClickEvent> action) {
GuiItem guiItem = ItemBuilder.from(item).asGuiItem(action);
gui.setItem(slot, guiItem);
}
are you making a new ItemStack every time?
as it should override with a completely new one, unless you're like appending to the lore or something
I get it from another class, then append the lore, which is probably the issue
ItemStack item = kit.getUnlockedItem().getA();
ItemMeta meta = item.getItemMeta();
List<Component> lore = meta.lore();
lore.add(Component.text("Current tier: " + tier.toString()));
lore.add(Component.text("Next tier: " + nextTier.toString()));
lore.add(Component.text("Left click to select - Right click to upgrade"));
meta.lore(lore);
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.lore(lore);
yeah it's absolutely the issue
So I need to clear the lore firstly
I am having a problem trying to get CraftBukkit on 1.18.1, I tried to use build tools but it doesn't make a craft bukkit jar. Is there a solution to use NMS in 1.18.1 I need to use packets for block breaking play stage.
Hello, each time i try to get my main class to read the Listener class i get this error 'Listener' is abstract and cannot be instantiated.
My listener class is named Creeperexplode.
and you're doing new CreeperExplode?
and it's in a file named CreeperExplode?
no i was doing new Listener each time that's why it was not working, im dumb thanks its not throwing errors now π€£
DM me and discord wil .txt it
Does spigot have a method, list or other of blocks (materials) that have physics? Don't want to make a list if one already exists.
all blocks can be falling, therefore it wouldn't make much sense to have a list of blocks that are falling by default
But not all blocks fall (by physics)... so there should be a list already made lol
declaration: package: org.bukkit, enum: Material
I had to scroll through the whole list on my phone
Kinda vague description but I'll see if it includes all the materials I need.
Thank you.
hmm it would be cool if Mojang made that a tag
for(Material mat : Material.values())
if(mat.hasGravity() && mat.isBlock()) ConsoleOutput.debug(mat.name());
yeap doesn't include all blocks affected by physics.
Doors, rails, buttons, torches etc...
[DEBUG] SAND
[DEBUG] RED_SAND
[DEBUG] GRAVEL
[DEBUG] DRAGON_EGG
[DEBUG] ANVIL
[DEBUG] CHIPPED_ANVIL
[DEBUG] DAMAGED_ANVIL
[DEBUG] WHITE_CONCRETE_POWDER
[DEBUG] ORANGE_CONCRETE_POWDER
[DEBUG] MAGENTA_CONCRETE_POWDER
[DEBUG] LIGHT_BLUE_CONCRETE_POWDER
[DEBUG] YELLOW_CONCRETE_POWDER
[DEBUG] LIME_CONCRETE_POWDER
[DEBUG] PINK_CONCRETE_POWDER
[DEBUG] GRAY_CONCRETE_POWDER
[DEBUG] LIGHT_GRAY_CONCRETE_POWDER
[DEBUG] CYAN_CONCRETE_POWDER
[DEBUG] PURPLE_CONCRETE_POWDER
[DEBUG] BLUE_CONCRETE_POWDER
[DEBUG] BROWN_CONCRETE_POWDER
[DEBUG] GREEN_CONCRETE_POWDER
[DEBUG] RED_CONCRETE_POWDER
[DEBUG] BLACK_CONCRETE_POWDER
[DEBUG] BlockList >> Size: 23
yeah well those are blocks that have gravity
as the name of the function suggests lol
I know. I'm telling MasterOfTheFish its not what I need.
so what you need is to know if a block type requires a "support" block, is that what you mean?
basically
hmm I vaguely remember seeing a function that tells you that... might be internals
Yeah not finding anything other then making my own list.
I have a plugin with custom drops from stone and from what i've searched online the only way to block the drop of cobblestone is to cancel the event and set the block to air, however doing this cancels the sound of the block being broken for other players around you. Anyone know a way around this so people around you can still hear you breaking the block?
Not sure what version you're on, but on 1.18 you can do BlockBreakEvent#setDropItems(false) to stop it from dropping the default items
So im tryna make it so that all zombies have sharp 5 netherite swords but i don't know which enchantment it is, is it DAMAGE_ALL?
does this seem like a good structure?
The idea behind Friend and Friends is that Friends returns a list of Friends and is also used to modify that list.
while Friend contains one single person and their permissions
unsure if that even makes sense xD
Friends return a list of Friends
The fact that this sentence is ambiguous already shows that you have a problem with naming
Friend & FriendList, problem solved
i mean i have no idea if the actual code makes sense
but sure i guess
not a massive fan of the {something}s naming scheme tbh
feels like it could be improved
Ye me neither, I was just stupidly dumb and didn't think about FriendList
same with Upgrades
and maybe Permissions
it's not entirely obvious what the classes are doing
should probably name them like FriendPermissions and GenUpgradeList
would that sound better?
"sound" I meant be better lol
much better
This is a list of the constructors of all of them:
Friend(UUID friend, FriendPerms perms)
FriendPerms(boolean upgrade, boolean sell, boolean addFriends, boolean place, boolean remove) {
Generator(String type, Location location, UUID owner, GenUpgradeList upgrades, FriendList friends)
GenUpgradeList(int speed, int dropQuantity, double sellMultiplier)
hopefully it gives you a bit of the idea behind it
I mean, true, it's meant to be all the upgrade levels a generator has
so list would probably be a bad naming too
GenUpgradeLevels?
seems more accurate
honestly just be as specific as possible
that's generally a good rule
makes sense
uh also is the logic behind the whole system a good way of doing it?
(Asking mainly because it's actually the first time I am trying to go for a more organized environment using different classes instead of having everything above in one single class)
Scuze me
ok

I'm trying to get a BiomeSettingsGeneration var but when i try to get it i am getting some issues:
BiomeSettingsGeneration.a gen = (new BiomeSettingsGeneration.a()).a();
Its saying "Cannot resolve symbol 'a' (the first a after BiomeSettingsGeneration).
When i look in the decompiled class from nms it obviously shows a static class, am i doing something wrong?
did you try removing that .a? (honestly don't know, lol let me do some research)
this might help?
fixed link
Hmm, i'll take a look at it
Yeah, that was in the code before
But i am updating it to 1.18
oh ok
And WorldGenSurfaceComposites doesn't exist anymore
I legit can't find anything about BiomeSettingsGeneration in 1.18
this is the class
Are there javadocs for nms?
xD
TBH no idea, I know that IrisDimensions has custom color skies, etc. Maybe contact the devs and ask them? Or just wait until someone here has an answer, sadly can't help
not exactly an javadoc but kind of browser
doesn't contain anything about biomes soo

Is that plugin paid? or has it been uploaded to github?
it is a paid plugin, unsure if it's on github
any way to hide this?
Does anyone one know how to work with Protocol Lib?
I have a question about some packets.
Thats displayed only on the creative tab
oh ye I am stupid, thx
Ask away @slow folio
oh yeah that too
the channel π₯²
favorite π
favo**U**rite
yes sir
good
ed for life baby
do i need to tell you to shut it too??!?!?!?
make sure to tell me one one line
i stopped
can't see more than one at a time
ed sheeran
hello
he asked a question
yes why is he asking a question
it is not a good question to ask
i dont know what he is asking
elaborate NOW dkim
can I delete my message
no you can not
can I edit my message
you can elaborate on your question
?
π
come on dkim i dont have all day
yes thats a good idea
good luck on it
maybe you should stop distracting me by asking about random things like ed sheeran
thanks
yeah youd better be sorry
Does someone know... Is there a way where i can allow Players only to break their own placed blocks ?
using an existing plugin?
or are you trying to code one
if you're trying to look for an existing one, I'd suggest #general-plugins since this channel is for coding help
Oh thanks and sry
Okay so basically I'm trying to make it so I can alter the block break speed and save the block break animation like cosmic prisons
I have a basic system setup so far
prisonCore.getProtocolManager().addPacketListener(new PacketAdapter(prisonCore, ListenerPriority.NORMAL, PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
EnumWrappers.PlayerDigType digType = packet.getPlayerDigTypes().getValues().get(0);
if(digType == EnumWrappers.PlayerDigType.START_DESTROY_BLOCK){
//Start task, call begin event,
} else if(digType == EnumWrappers.PlayerDigType.ABORT_DESTROY_BLOCK){
//Cancel task, save block break state.
} else if(digType == EnumWrappers.PlayerDigType.STOP_DESTROY_BLOCK){
//Cancel task, Remove block break state from map, call end event.
}
System.out.println("DigType: " + digType.name());
}
});
Which I am still thinking about in my head and may work, would be to simulate the whole breaking process if they are using a tool with a persistent variable (using PersistentDataContainer). The process would be able to be run on a timer, where I can decide the time intervals between each break animation progression. This way, I could calculate the time (in ticks) from a few variables: the amount of time the vanilla item we are modifying takes to break the block (for diamond pickaxe on stone it would be 0.3 seconds), and the multiplier that I want to add onto that time (an example could be 1, this would add 1 * 0.3 to the original, 0.3 resulting in 0.6, doubling the speed the item breaks blocks). I would send a block animation packet every tick (so when people right click it the breaking texture doesn't go away) in which the player is actively trying to break the block. Of course, I would kill the runnable when the player stops breaking the block in any way shape or form.
i have problem with maven, https://paste.helpch.at/egitagafih.rb
my pom.xml file: https://paste.helpch.at/ogaxajisor.xml
does anyone know?
do you have ```gradle
tasks {
assemble {
dependsOn(reobfJar)
}
}
yes
oh but I'm using groovy DSL, will that be ok or will I have to do something else?
prob similar code still
maybe like tasks.reobfJar
idk
> Could not get unknown property 'reObfJar' for task ':assemble' of type org.gradle.api.DefaultTask. well
https://paste.helpch.at/kinayaquqo.rb here's my gradle file
try this
alr
wait how exactly
nvm it was because its reobfJar
not reObfJar
Bump
Still happens
the error
this is how I did the task thing:
tasks.assemble {
dependsOn(reobfJar)
}
probs wrong
how are you building the plugin? what are you doing exactly?
π₯΄
also thats 3 different dependency formats right there π₯²
also dont u need paperDevBundle?
or does groovy need something different (in this one it's paperweightDevelopmentBundle)?
that doesn't work on groovy dsl, no
ah
lmao
alright
it didnt work
same fucking error
I'll just rework the NPC code
that was what was causing the error
@wintry grove can you answer my question lmao
yes, don't do that
run reobfJar only and use the non -dev jar
alright
Caused by: java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_18_R1/entity/CraftPlayer
at com.starl0stgaming.lostworlds.commands.SpawnNPCCommand.onCommand(SpawnNPCCommand.java:29) ~[lostworlds-0.0.1-ALPHA.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
... 21 more
crap
and it also included protocollib on the .jar lmao
,
that looks okay
can you show your new build script?
sorry for being stupid but how was it done?
first run clean, then reobfJar again
please someone respond, i been searching the whole day for fix π¦
alright that worked
but havent tested the npc code
Anyone have an idea on why this might be happening?
LivingEntity shooter = ((LivingEntity) npc.getEntity());
shooter.launchProjectile(Arrow.class);```
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow cannot be cast to org.bukkit.entity.LivingEntity```
Very strange
bruh
itβs not very strange
the arrow isnβt a living entity
itβs a entity
but not a living one
From NPC?
That would be super odd if npc was returning an arrow
npc is nms made
no
Its a CitizensAPI npc
I still fail to see how this means its returning an arrow
Ill show you the constructor
public class ZombieBoss extends PitBoss {
public NPC npc;
public Player entity;
public Player target;
public String name = "&c&lZombie Boss";
SubLevel subLevel = SubLevel.ZOMBIE_CAVE;
public ZombieBoss(Player target) throws Exception {
super(target);
this.target = target;
npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, name);
entity = (Player) npc.getEntity();
CitizensNavigator navigator = (CitizensNavigator) npc.getNavigator();
navigator.getDefaultParameters()
.attackDelayTicks(10)
.attackRange(10)
.updatePathRate(5)
.speed(2);
npc.setProtected(false);
skin("zombie");
spawn();
BossManager.bosses.put(npc, this);
}```
Well thats just a class I make it in
Its still NPC type, extends Player though
You mean the CitizensAPI NPC class?
yes
1s
okay
The only thing I can possibly think of is that when I launch a projectile from the NPC, the entity object temporarily is replaced with the arrow (???), since the arrow still actually fires with no issues
Nope, its not
Ill probably just end up suppressing the error
bump
watch a tutorial
I want to change the mining speed so the intervals between the stages in the block break stages and break the block when it hits 10 ( resets ). But I want to save the block break stage to that block for 30 seconds if they stop mining it and that deletes by itself so we donβt need to handle that. so i made a hash map that has a block and block break data class i made, this block data class just contains the entity id, the block type ( I change it to stone once they hit the 10th stage ( reset ). the task thatβs ran for the block stages ( it counts by ticks and the stages go by ticks which iβll make a formula to determine that number of ticks per stage. )
This is all done using the ItemHeldEvent
With a few packets inside from protocol lib
such as
Block break packet
Player Dig packet
question, what event in bungee is called when a player connects
Maybe ServerConnectEvent
PlayerInteractManager, i guess, on 1.12.2, k field
U will need interact with nms code, so ye
That won't work
Because I need to alter the block state after they mine it
And if they stop mining it
could I use pdc on a player to store data instead of storing things in a file?
like serialize stuff, turn it into base64 and store it with pdc in a player
Yes, I'm certain you can
well is it a good way of doing it?
Of course it's good
package com.test;
import com.mojang.authlib.GameProfile;
import javafx.beans.property.Property;
import net.minecraft.server.v1_16_R3.EntityPlayer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.UUID;
public class corpseentity {
public static void execute(Player player){
EntityPlayer craftplayer = ((CraftPlayer)player).getHandle();
Property textures = (Property) craftplayer.getProfile().getProperties().get("textures").toArray()[0];
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), player.getName());
gameProfile.getProperties().put("textures", new com.mojang.authlib.properties.Property("textures", textures.getValue(), textures.**getSignature**));
}
}
why doesnt getSignature not work here? (markt with stars to make more clear)
import javafx.beans.property.Property;
uhm are you sure this is the correct type of Property class?
witch of these would be better then?
authlib one
ty
huh its not in the list
π§ββοΈ
shut
EntityPlayer corpse = new EntityPlayer(
((CraftServer) Bukkit.getServer()).getServer(),
((CraftWorld)player.getWorld()).getHandle(),
gameProfile);
imports:
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.minecraft.server.v1_16_R3.EntityPlayer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
error =
'EntityPlayer(net.minecraft.server.v1_16_R3.MinecraftServer, net.minecraft.server.v1_16_R3.WorldServer, com.mojang.authlib.GameProfile, net.minecraft.server.v1_16_R3.PlayerInteractManager)' in 'net.minecraft.server.v1_16_R3.EntityPlayer' cannot be applied to '(net.minecraft.server.v1_16_R3.DedicatedServer, net.minecraft.server.v1_16_R3.WorldServer, com.mojang.authlib.GameProfile)'
what did i do wrong?
There is a 4th parameter PlayerInteractManager that need to be passed to the EntityPlayer Constructor, thats what the error meansβ¦
show code
also the error literally shows the problem
yo
i have a bug on my server
where even if keep inventroy is set to false
players are keeping their inventories when they die
any plugin you think overrides this?
... I said to ask in #general-plugins
Yoo! I changed from Eclipse to IntelliJ IDEA and when i imported my project to it i get a lot of "might be null" and "null check" warnings... Anyone know how i can get rid of them without changing a lot of code. Or should i just leave the warnings?
I know... So you say that i should check if everything is null?
myes
Unless like you are 100% certain it won't be null
then you can slap a @SupressWarnings on the method, but generally you should consider those kinds of warnings
Yeah alright
I also get this: Condition 'sender instanceof Player' is redundant and can be replaced with a null check
What should i do about this
Don't really understand it
it means that it already knows it's a Player if sender is not null (null is not an instance of anything) so you can replace that with a null-check instead (I don't know the exact context of that warning so I can't really say anything else on how you'd go about doing that exactly without seeing contextual code)
Hmm. Here is the code: https://paste.gg/p/anonymous/680462379a02403f8eda3f7afb4f9ffb
Don't know if that says anything but i changed if(sender instanceof Player) {} to if(!(sender == null)) {}
And again, don't know if that is how i should do it
Because i have always used if(sender instanceof Player) in eclipse
Move the instanceof check above the casting
No problem
Sorry to bother you guys, but does anyone have an idea as to why these potion effects arent being added?
public static void moveWither(Player player) {
Wither wither = withers.get(player);
wither.setCustomName(ChatColor.translateAlternateColorCodes('&', messages.get(player)));
double health = wither.getMaxHealth() * progress.get(player);
wither.setHealth(health);
wither.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 20 * 60, 1, true, false));
wither.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 60, 1, true, false));
Location location = player.getTargetBlock((HashSet<Byte>) null, 5).getLocation();
wither.teleport(location.add(0, 3, 0));
Bukkit.broadcastMessage(wither.getActivePotionEffects() + "");
}```
I run this every 5 ticks, and the broadcast always returns empty
probably have to like apply it or something
ah, addPotionEffect returns a boolean indicating whether the effect could be added
Ah
Let me check that
Hmm?
Its returning true
But the Effect isn't being applied
No errors either
I think the issue is that there are somehow 2 PotionEffect classes under the same package
One with a sixth boolean variable, and one without
The issue though is I can't choose that one since they literally have the same package
Idk how thats even possible
Hey guys any one knows how to get a player head that looks like this:
https://cdn.discordapp.com/attachments/961676153091936276/962123657457586237/unknown.png
instead of this:
https://cdn.discordapp.com/attachments/936727992976166972/962143394761682965/unknown.png
That looks like a resource pack issue
you mean that the resource pack is deciding that all the heads should looks like the first img instead of the normal player_heads right?
Yeah
[02:25:11 WARN]: Error dispatching event ServerConnectEvent(player=SquareWings928, target=BungeeServerInfo(name=Hub-01, socketAddress=/136.243.134.184:25566, restricted=false), reason=JOIN_PROXY, request=net.md_5.bungee.api.ServerConnectRequest@7d9dadb5, cancelled=false) to listener me.squarecodes.events.ServerEvents@28a9494b
java.lang.NullPointerException: Cannot invoke "net.md_5.bungee.api.connection.Server.getInfo()" because the return value of "net.md_5.bungee.api.connection.ProxiedPlayer.getServer()" is null
Line 43.
player.sendMessage(new TextComponent("Β§c[S] Β§4" + p.getName() + " Β§7has joined Β§c" + p.getServer().getInfo().getName()));
Whole event (
@EventHandler
public void onProxyJoin(ServerConnectEvent e) {
if (e.getReason().equals(ServerConnectEvent.Reason.JOIN_PROXY)) {
ProxiedPlayer p = e.getPlayer();
if (e.getPlayer().hasPermission("bungeeutils.staff")) {
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
if (player.hasPermission("bungeeutils.staff")) {
player.sendMessage(new TextComponent("Β§c[S] Β§4" + p.getName() + " Β§7has joined Β§c" + p.getServer().getInfo().getName()));
}
}
}
} else {
return;
}
}
```)
Should i instead do
ServerInfo server = e.getTarget();
and then server.getName()
Yeah okay answered my own question
Just gonna bump this
can wither bosses even have potion effects?
Are you trying to make boss bars for the player?
Yeah
I would probably use packets for it if possible, or you can use the adventure API I think
But if you want to do it this way, you could use LivingEntity#setInvisible and cancel entity damage for it
And adventure API is buggy
adventure isn't buggy lmao
Yeah I haven't heard of it being buggy
The Boss bar was for me
MiniMessage with its breaking changes on the other hand...
it's used by literally hundreds of developers across hundreds of hundreds of projects
No, the setInvisible method is not available for the version I'm using
I'm just trying to figure out why I cannot set a PotionEffect
Oh, try setVisible
Nope.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#setInvisible(boolean)
What version are you using?
man just use adventure
it's in maven central so it most definitely didn't lol
Either use Adventure or packets
Must have been using some other fork then lol
Or use a newer version
No problem
Anyone knows how to create a placeholder that can be clicked via chat using javascript?
I'm creating a placeholder which then being called whenever a command is being executed. However, I need to create pages which calls another command to be executed upon clicking.
Using javascript? Do you mean Java?
Ah, thanks!
Not using that method
So, what should I use instead?
You'd have to setup a listener and all that to test for the recipe yourself
ok
Only if you are dealing with itemstacks that have a amount > 1
You could use ExactChoice if you just want to match itemstack but not amount
iirc
I already checked this but it doesn't provide any TellRaw feature.
How can i check if a string is null? Because after i switched to intellij from eclipse i got alot of Argument 'Main.getPlugin().langManager.getConfig().getString("prefix")' might be null warnings
The quick fix for it is to do Objects.requireNonNull() but i don't know if i should do that or not
if (string == null)
You shouldn't, that will throw an error if the string is null
Uhh okay
If i do this i still get the warning ```java
if (!(Main.getPlugin().langManager.getConfig().getString("prefix") == null)) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&'
, Main.getPlugin().langManager.getConfig().getString("prefix")));
}
Or do i need to this first String noCommand = Main.getPlugin().langManager.getConfig().getString("noCommand");
and then this ```java
if (!(noCommand == null)) sender.sendMessage(ChatColor.translateAlternateColorCodes('&', noCommand));
You can do stringHere = null
Okay
Do i need the toString() in Player targetPlayer = Bukkit.getPlayer(args[0].toString());?
ugh. what is the args? if its an array of string then no
Yeah okay, It is an array of string
Which IDE are you using? IntelliJ should tell you that you didn't need the toString()
Even eclipse tells you that no?
Yeah, i switched to intellij yesterday from eclipse and i got A LOT of warnings
:))
IJ has a lot more warnings than Eclipse, I don't remember it warning me about the toString before, and I had a few of useless ones in my old code I was looking the other day
Is it possible to use an API that needs to be installed into the plugin folder without putting it into the plugins folder. But instead somehow put it in the java/maven project? I think i read something about that last week
Like, you want to shade a library?
Like put it inside your own jar so it's not needed to be present as a separate plugin?
Uhh i dont really know...
Yes
Exactly
It depends on the library, you don't want to do that with things like PAPI, ProtocolLib, etc
But most others you'd shade it
Hmm okay, why should you not do it?
Because they are already provided as separate plugins
They aren't much of libraries but access points for you to hook into the plugin that already is there
Yeah okay
Well, if i ask this instead... Do i need some kind of API to be able to open up a "remote" anvil and crafting table? Because i have only found stuff about opening chest inventories
You can definitely do it without any library, but it's much easier if you use one, those should definitely be shaded into the plugin
Alright
When my plugin turn on I get this warn:
[21:18:18 WARN]: Nag author(s): '' of '' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
I know this isn't an error but how can I fix it anyways?
Yes, don't use println for logging, use the Plugin's logger
any examples?
plugin.getLogger().info("Hello!") or if colors are important you'd use the console sender
ok fine thanks
In my experience colors also worked when using the logger
Only on Paper servers iirc
Only on consoles that allow color.
You mean that⦠terminals that can't render colors⦠can't render colors?
Shocked
π₯΄
I feel like you're reading the message wrong lol. Matt implied colors only worked on paper. I said color only works on consoles (terminals) that support colored text.
iirc windows cmd shows colors on some paper versions but not on 1.8 spigot for instance
I thought paper only recently started adding colorcodes to their logger?
From what I know paper has supported ANSI formatting for longer than Spigot
I mean like to the text itsself not additional.
Like for example you can use color codes in logger but spigot defaults its text to white.(Of the default of the system font)
what
yesssss
Hello yes I am trying to access new discord servers but I run into a verification problem where it tells me an existing account is already using my phone number.
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
Sir this is Wendy's
wtf this is a minecraft discord
on spigot colors are displayed as [3;something or what the format is
or at least they used to
π₯²
Like for example if you start a spigot server all text will be white (or default color) with paper only the logs will be white but everything else will have color. Info has yellow warning has red etc... (Not talking about messages added by plugins)
oh that uh I thought spigot handled that to?
No everything is white by default (or your terminals default color). (Again not including plugins if they use color in their logger code)
wtf is this shit? i have a library bundling all that, i dont need repositories for that when the lib is bundling it either way, do I?
How would be the best way to ban a player from a bungee plug-in? Is there anyway i can dispatch a spigot command?
Get a Bungee based ban plugin, where it'd be universal if that's what you need.
Use the built-in ban commands for a individual server, or get a plugin to manage your bans.
try refreshing your project dependencies i guess cuz internals are on R2 (gradlew dependencies --refresh-dependencies will do)
alright
or depending on the actual version you're using
you're trying to run on 1.18.2, i don't know if you're depending on 1.18.1 or .2
oh that explains it
mhm that would do it
> Could not find io.papermc.paper:dev-bundle:1.18.2-R0.1.
hmmm
oh nvm its working
Is there a good efficient way to serialize an inventory, send it over redis, and deserialize it back into its exact place on the same player that switched servers?
I would use that for inspiration if you intend to make your own
JSON or binary serialization is probably your best bet
Thanks
Hi, anyone encountered the chats being shown as [[playername]] everytime they use the command /reply, /r, /whisper, and /w ? It's some sort of a spy. Already disabled most of the permissions but still showing on OP players.
Hello, when I compile the code I get this weird error and don't really understand what I'm doing wrong. Help!
typical maven
Event called when block is exploded by explosion (tnt or creeper)?
maven user problems
I fixed it
Im working on SignGUI over 10 hours and everything i find is outdated or doesnt work. I basicly want to make it so you have a shop and you can set the title of that shop by clicking on a button and a sign will pop up where you can type something in and then make it so the title will be what the players shop name will; be what he typed in the sign. Does annyone have any expiriences with this or wants to help me with this? you can dm me.
Hello, my code here isn't working, I have reviewed a lot of resources and can't figure out why it doesn't work.
plugin = this;
NamespacedKey glowkey = (new NamespacedKey(this, "glow"));
this.getServer().getPluginManager().registerEvents(glow, this );
ItemStack glowitem = new ItemStack(Material.BOOK, 1);
ItemMeta glowmeta = glowitem.getItemMeta();
PersistentDataContainer glowdata = glowmeta.getPersistentDataContainer();
glowmeta.setDisplayName("Β§d");
glowdata.set(glowkey, PersistentDataType.STRING, "glow");
glowitem.setItemMeta(glowmeta);
NamespacedKey glowrecipekey = new NamespacedKey(this, "glowrecipekey");
ShapedRecipe glowrecipe = new ShapedRecipe(glowrecipekey, glowitem);
glowrecipe.shape("EEE", "ECE", "EEE");
glowrecipe.setIngredient('E', Material.GOLD_BLOCK);
glowrecipe.setIngredient('W', Material.GLOW_BERRIES);
glowrecipe.setIngredient('G', Material.GOLDEN_CARROT);
glowrecipe.setIngredient('C', Material.BOOK);
Bukkit.addRecipe(glowrecipe);
And what exactly doesn't work?
I put the items into that pattern in the crafting table and nothing is the output
/papi ecloud download Player doesnt work for me
pls help me I need it
Am running 1.16.5
PaperMC
Hi, I'm looking for a developer for a paid Java Spigot 1.18 plugin development job
Thanks
Is it a method to get cooking time for x item (or is it same for every item)? for example coal ore.
And also for exp is it method to get default exp? I only find #result()
Has anybody experimented with dynamic memory class loading from a web server instead of transpiling to a jar? itβs usually used to prevent cracking a plugin
it means the data is still transferred to the user at some point. If someone wants to "crack" it, they'll still do so
Yeah it doesnβt actually stop it
It just makes it a lot harder
Requires dumping the contents of memory which isnβt hard if you know what youβre doing but a larger number of people donβt know how
Someone?
EntityExplodeEvent?
waht about BlockExplodeEvent, also?
that is for when blocks themselves explode
like beds in nether/end or the respawn anchor

what
Anyone able to explain why the fuck the display on a tipped arrow is fucky wucky
"the display"?
hold
"arrow"?
because bukkit sucks ass
spigot bug?
nope minecraft bug
minecraft:tipped_arrow{CustomPotionEffects:[{Id:1,Duration:100,Amplifier:1}]}
what's the bug
is that even how you apply effects to tipped arrows..?
Looks like it is
The effects are active
like if you shoot something with the arrow, they will get the effect
why does it say uncraftable
Probably if the effect doesnt have the vanilla values it will say that
if the nbt tag.Potion is unset
The default value is "minecraft:empty", which gives it the "Uncraftable" name.
so I'm getting this error ```
java.lang.NullPointerException: Cannot read field "glowkey" because "me.nrgking.imbuements.ImbuementsMain.glow" is null
at me.nrgking.imbuements.Imbuements.Glow.<init>(Glow.java:25) ~[?:?]
at me.nrgking.imbuements.ImbuementsMain.onEnable(ImbuementsMain.java:27) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:517) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:431) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:263) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1007) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3468-Spigot-ffceeae-d53c4fb]
at java.lang.Thread.run(Thread.java:833) [?:?]
my main class is
private static ImbuementsMain plugin;
public static Glow glow;
@Override
public void onEnable() {
plugin = this;
NamespacedKey glowkey = (new NamespacedKey(this, "glow"));
this.getServer().getPluginManager().registerEvents(new Glow(), this );
ItemStack glowitem = new ItemStack(Material.BOOK, 1);
ItemMeta glowmeta = glowitem.getItemMeta();
PersistentDataContainer glowdata = glowmeta.getPersistentDataContainer();
glowmeta.setDisplayName("Β§dGlowing Spellbook");
glowdata.set(glowkey, PersistentDataType.STRING, "glow");
glowitem.setItemMeta(glowmeta);
NamespacedKey glowrecipekey = new NamespacedKey(this, "glowrecipekey");
ShapedRecipe glowrecipe = new ShapedRecipe(glowrecipekey, glowitem);
glowrecipe.shape("EEE", "ECE", "EEE");
glowrecipe.setIngredient('E', Material.GOLD_BLOCK);
glowrecipe.setIngredient('W', Material.GLOW_BERRIES);
glowrecipe.setIngredient('G', Material.GOLDEN_CARROT);
glowrecipe.setIngredient('C', Material.BOOK);
Bukkit.addRecipe(glowrecipe);
}
public static ImbuementsMain getPlugin(){
return plugin;
}
my other class is ```java
NamespacedKey glowkey = ImbuementsMain.glow.glowkey;
@EventHandler
public void GlowHit(EntityDamageByEntityEvent e) {
if (e.getDamager() instanceof Player) {
Player player = (Player) e.getDamager();
if (e.getEntity() instanceof Player); {
LivingEntity victim = (LivingEntity) e.getEntity();
ItemStack item = player.getEquipment().getItemInMainHand();
PersistentDataContainer data = item.getItemMeta().getPersistentDataContainer();
if (data.has(glowkey, PersistentDataType.STRING)) {
victim.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 600, 1));
}
}
}
}
@EventHandler
public void GlowInteract(EntityInteractEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
ItemStack item = player.getEquipment().getItemInMainHand();
ItemMeta meta = item.getItemMeta();
PersistentDataContainer data = meta.getPersistentDataContainer();
ItemStack item2 = player.getEquipment().getItemInOffHand();
PersistentDataContainer data2 = item2.getItemMeta().getPersistentDataContainer();
if (data2.has(glowkey, PersistentDataType.STRING) && item.equals(Material.DIAMOND_SWORD)) {
data.set(glowkey, PersistentDataType.STRING, "glow");
item.setItemMeta(meta);
player.sendMessage(ChatColor.LIGHT_PURPLE + "Your weapon glows with an ethereal light.");
}
}
}
NamespacedKey glowkey = ImbuementsMain.glow.glowkey;
You don't assign that to the property in your main class ever
wdym?
how would I do this?
in your onEnable, this.glowkey = glowkey
@tight junco actually the bug isn't that it displays the wrong duration, the bug is that it applies the wrong duration from the CustomPotionEffects π₯΄

The duration applied should be an 8th of the duration specified, it displays it correctly but it applies the effect without reducing it lmao
hey so i just started using spigot and i have a basic knowledge about java, anyways so i was trying to make a cooldown for my "FeedCommand", but i was getting this error!
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.HashMap.get(Object)" is null at me.cqveman.learning_everything.commands.FeedCommand.onCommand(FeedCommand.java:32) ~[?:?]
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
im a beginner so plz explain
you need to check if the player's UUID is in the map after line 32
because timeElapsed == null
also strange messages but aight
yes and how can i do that :). (show me in code)
as i said im a beginner..
d;Map#containsKey
boolean containsKey(Object key)
throws ClassCastException, NullPointerException```
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)
key - key whose presence in this map is to be tested
ClassCastException - if the key is of an inappropriate type for this map (optional)
NullPointerException - if the specified key is null and this map does not permit null keys (optional)
true if this map contains a mapping for the specified key
im not gonna spoonfeed you 
how can icheck
so true
np
hey uhm




