#help-development
1 messages · Page 2220 of 1
You may need to create all combinations and register the recipe
Hey all,
this is probably a message you will skim over.
However me and my mate have an amazing idea for a project
however we are in need of a developer.
if this is something you are interested in then the idea can be
further explained in DM
there is a slight catch. me and this mate are both students.
money is not the easiest to come by. however we are devoted to this server
and would love to have someone join the team. and once the server has launched etc
money that we receive we will aim to provide you with money worth your time (dependent on server growth)
any questions or possible discuses the offer please DM me
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
im working on a crafting engine where you can configure it to work with any skull, but its sort of broken rn
There a reason my server would use 50% of my CPU just having a player run around?
ope ya
Where is the problem with my recipe?
I added 5 items with count 1 and the plugin disables with the message i cannot have more then 9 ingredients
https://paste.labymod.net/epibegejor.cs
So I'm currently trying to get an advancement using this Bukkit.getAdvancement(NamespacedKey.fromString("advancement here")) and it only works with default minecraft advancements, not custom ones. Does anyone know a way to be able to make it work with custom ones as well?
your code is setting all the ingredients to be placed in slot 1 of the crafting table
you need to actually make the recipe
1, 2, 3
4, 5, 6
7, 8, 9
So the first parameter is the slot?
How do you set durability of players item?
ItemStack item = player.getInventory().getItemInMainHand();
Damageable meta = (Damageable) item.getItemMeta();
meta.setDamage(500);```
doesnt work
i believe so i could be wrong just going of memory
no, that's wrong too D:
pass your plugin instance as the second paramater in NamespacedKey.fromString
Would that make it work with both custom and default advancements, though?
if you want to get a default advancement then you could use NamspacedKey.minecraft("advancement")
one of these two
`ShapelessRecipe recipe = new ShapelessRecipe(new NamespacedKey(this, "Chunkloader"), ChunkLoader);
recipe.addIngredient('1', Material.CREEPER_HEAD);`
not really since thats the whole point of namespaced keys, you can just check both though
The first parameter is an integer
It’s the “amount” of the item you need
So 1 creeper head
Since that’s a shapeless recipe there is no “slot”
Not ‘1’, 1
?paste
cannot believe i didnt see that lol
RankManager: https://paste.md-5.net/newujodoto.cs
RankEnum: https://paste.md-5.net/onasawuhac.java
Problem: I dont understnad why I cant do player.setDisplayName(Rank.prefix.get(rank) + player.getName());
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.
Rank.prefix.get(rank) + player.getName() 😵
I did make it
Rank.prefix isn’t a static variable it’s a local one
Lol
No you didn’t
You need to learn Java before attempting this
Someones angry
lul
I’m not angry 😂
Rank.getPrefix() not rank.prefix.get
calm down (╯°□°)╯︵ ┻━┻
I’m just letting you know that you lack the required knowledge to make a plugin
And where to obtain said knowledge
meanie
Big time
hehe
running into a very weird compilation error "cannot find symbol" however at the line described there are no problems whatsoever
any1 any idea what could be causing this?
Show us the line
import me.epicgodmc.epicgens.compatibility.CompatibilityManager;
got it to work, thanks for the help, though :)
invalidate caches and restart
tried it. did not work
Wrong path or dependency is missing
shoulnt it say "does not exist" then?
Did you import a dependency from the jar directly with your IDE and then try to build with maven
Make sure you have your jdk set up so "import" is recognised.
its a module
Did you install the module?
well it gets auto installed
is it configured in your pom as a module. Does it correctly have its own pom?
as my other module needs it
it is
Hey for some reason when i added a cooldown thing to my taser plugin the cooldown doesn't work and the console goes nuts
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.UUID;
public class Cooldown {
public static HashMap<UUID, Double> cooldowns;
public static void setCooldowns() {
cooldowns = new HashMap<>();
}
//setCooldown
public static void setCooldown(Player p, int seconds){
double delay = System.currentTimeMillis() + (seconds*1000);
cooldowns.put(p.getUniqueId(), delay);
}
//getCooldown
public static int getCooldown(Player p){
return Math.toIntExact(Math.round((cooldowns.get(p.getUniqueId()) - System.currentTimeMillis())/1000));
}
//checkCooldown
public static boolean checkCooldown(Player p){
if(!cooldowns.containsKey(p.getUniqueId()) || cooldowns.get(p.getUniqueId()) <= System.currentTimeMillis()){
return true;
}
return false;
}
}```
Only rule that matters for cooldowns:
Dont use runnables for decrementation. Always use timestamps.
uhh looks like making it more difficult with static
huh
what is the best way to store a date in json?
- Make the map private. You should never make any data structure (like maps, sets and lists) public and you should never have any getter or setter for them.
- Combine setCooldowns and your field initialisation.
- Use Longs for timestamps
private static final Map<UUID, Long> cooldowns = new HashMap<>();
There is no "best" way. If it doesnt need to be readable then you can just use a unix timestamp.
Cooldowns are a thing you can write once and then reuse it everytime. https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/cooldown/Cooldown.java
and how do I convert it into a readable date then?
For example with a DateTimeFormatter
everything else is fine?
it doesnt have to be but it doesnt make sense to not make it private
sounds about right
new Date(Long);
fuck how do i send images
Usage: !verify <forums username>
i literally dont have an account
then create one
fair enough
😄
your "cooldowns" object is null
y tho?
How can i check if a recipe is already added?
Iterate through all recipes and see if the NamespacedKey exists already
dont make a setCooldowns method just initialize it right at the top
or https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getRecipe(org.bukkit.NamespacedKey) and check if its null
This is one way to do it when you want to use a higher level approach than raw millis.
public class Cooldown {
private static final Instant ZERO = Instant.ofEpochMilli(0);
private static final Map<UUID, Map<Object, Instant>> CD_MAP = new HashMap<>();
public static <T> void setCooldown(Player player, T key, Duration duration) {
CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).put(key, Instant.now().plus(duration));
}
public static <T> boolean isCooldownDone(Player player, T key) {
return Instant.now().isAfter(CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).getOrDefault(key, ZERO));
}
public static <T> Duration getCooldownLeft(Player player, T key) {
return Duration.between(CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).getOrDefault(key, ZERO), Instant.now());
}
}
to be fair i dont wanna make it too intricate or complicated
Nested collections -> Create new classes
my EyEs kekw
oh thats a pretty good idea
im not very excited to implement all the methods tho
so i think ima leave it like this
is that code bad or good im so confused
Do it. Makes your code more robust and readable.
i should be working with durations too instead of separate timeunits and longs
Who doesn't love a Map<List<String>, Function<Set<Predicate<Integer>>, IntUnaryOperator>>?
Yeah. Throw some Pairs and Tuples in there too...
i feel like an idiot for not understanding anything
But who in their right mind would use a List<String> as a primary key
We all start somewhere
I have done that before lol
no just in the same line
Well, it was String[] but still
Map<UUID, Double> cooldowns = new Hashmap<>();
Dont. Thats like one of the later steps you take when learning oop. First you need to get amazed by inheritance. Later
you throw it out the window because you discover composition.
primitive generics 🥺 🙏
for line 10?
turned out it was not compiling because i had <finalName> in my pom with a space in it
no idea what that had to do with line 7
ye
mystery to me
it creates errors i dont understand
Having an issue deleting a file using the java.io.File delete method. I'm able to read the contents of the File object, but when it comes to actually deleting that same object it does not work.
?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.
The file does not get deleted and I'm not sure why.
Use NIO instead.
Path filePath = Paths.get("path/to/your/file.yml");
try {
Files.delete(filePath);
} catch (IOException ioException) {
ioException.printStackTrace();
}
Thank you, will do
i always use Path.of(...) does that matter
I think it does the same
oh yeah lol
ye lol
https://hub.spigotmc.org/javadocs/spigot/org/spigotmc/event/entity/EntityDismountEvent.html is getDismounted() the entity that was being ridden, or the entity that is moving off the vehicle?
declaration: package: org.spigotmc.event.entity, class: EntityDismountEvent
Javadocs don't say
I'd assume that get Dismounted would return the horse
im confused too
And getEntity returns player
For player and horse that is
Entity what
There are other stuff
They could've called it rider or something
yeah like getVehicle and getRider
Or passenger
ye
Thank god its getEntity and not this
bruh how th do i get rid of these 0% classes ...
Wdym?
what editor is that
intellij
@Override
public boolean onCommand(CommandSender p, Command command, String label, String[] args) {
if(command.getName().equalsIgnoreCase("pve")) {
String prefix = getConfig().getString("messages.prefix");
p.sendMessage(color(""));
String world = getConfig().getString("spawn.player.world");
Double x = getConfig().getDouble("spawn.player.x");
Double y = getConfig().getDouble("spawn.player.y");
Double z = getConfig().getDouble("spawn.player.z");
Player player = Bukkit.getPlayerExact(p.getName());
tp(player, world, x, y, z);
}
return true;
}```
**why isn't my command working ingame? it doesn't show it exists..**
```yml
pve:
aliases: pvtp```
intellij theme?
like the stats on the right of each item
Did u register it?
how do i register a cmd?
with a background image
google it
with i believe either material or atom icons
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i have that in the on enable but idk if that registers cmds
in ur onEnable
this.getCommand("cmdhere").set Executor(command class instance here)
getCommand(name).setExecutor(new ClassThatExtendsCommandExecutor())
Help
and then set the code to run with plugin.getCommand(name).setExecutor(commandExecutor);
smh
where plugin is this in your main class
you can also just use the onCommand method but make sure that you command is specified in your plugin.yml
¯_(ツ)_/¯
its the other way around rip
Oh god
still not working
i guess its "what entity have you just dismounted" or something idk
console errors?
oh
Hey, how I can calculate the number of times a Shapeless recipe can be crafted in my custom crafting gui?
i still get the same Caused by: java.lang.NullPointerException: Cannot invoke "java.util.HashMap.containsKey(Object)" because "me.saeko.taser_plugin.Cooldown.cooldowns" is null error for my cooldown thing
I am getting this error when I run my maven build
error: invalid target release: 17.0.2
Module HAES SDK 17 is not compatible with the source version 17.
Upgrade Module SDK in project settings to 17 or higher. Open project settings.
Does anyone know what it could be?
why do you want to know this
Because i want to implement shift click and i will do a loop for every time the craft is possible
wdym
dont initialize your map in a static method, do a direct initialisation
I literally have no idea what that means im sorry
here
literally what i did
instead of static void initMap() { map = new HashMap }
just do Map<bla, bla> map = new Hahsmap() directly
what in the world
i think i messed up
Like if you can craft 5 netherite ingot with scrap and gold, when you shift click it give you all the 5 netherite ingot instead of clicking one by one
thats just default behaviour
why do you have two maps now
it's a custom crafting gui
I have no idea
remove the Cooldown map and instead initialize the cooldowns map
cuz you made them ¯_(ツ)_/¯
i guess iterate over the items and count how many materials there are?
yeah and then take the minimum from that
sorry for being annoying but i gotta remove private static HashMap<UUID, Double> cooldowns;
?
okay and?
no lol
my fucking brain is on airplane mode
private static Map<UUID, Double> cooldowns = new HashMap<>();
yes
and in my opinion you should make it a long, as youre using system.currentimemillis
then take amount items from every ingredient and set the result to the desired item with amount itemsPerCraft * amount
okay thanks very much
np
holy shit that worked thank you and im sorry for being stupid
How can I get active container window id from EntityPlayer?
In 1.16.5 I could use ((CraftPlayer)player).getHandle().activeContainer.windowId
But in 1.17 I can't found that field or method
Any ideas?
How do I use 1.19 packets? This is not working right now:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Anybody know anything about this? I made sure I have set all versions to 17 everywhere in the project structure. By this point I am just very confused
code that's causing error:
String world = getConfig().getString("spawn.player.world");
Double x = getConfig().getDouble("spawn.player.x");
Double y = getConfig().getDouble("spawn.player.y");
Double z = getConfig().getDouble("spawn.player.z");```
error:
```java
org.bukkit.command.CommandException: Unhandled exception executing command 'pve' in plugin PVE v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2262) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2073) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2054) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[app:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1404) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1286) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Name cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getWorld(CraftServer.java:1318) ~[patched_1.17.1.jar:git-Paper-411]
at gardened.pve.tp(pve.java:64) ~[PVE-1.0.jar:?]
at gardened.pve.onCommand(pve.java:58) ~[PVE-1.0.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-411]
... 21 more```
i don't get why im getting the error..?
World name is null
this is my config
spawn:
- player: # where /pve will take the player
- x: 100
- y: 100
- z: 100
- world: "world"```
That cuz that's a list
Not a valid config path
Remove the -
Also the spacing on that looks weird
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this better?
spawn:
- player: # where /pve will take the player
x: 100
y: 100
z: 100
world: "world"```
ok, worked
now im getting this though
[18:56:47 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'pve' in plugin PVE v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2262) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2073) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2054) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[app:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1404) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1286) ~[patched_1.17.1.jar:git-Paper-411]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Name cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.1.jar:git-Paper-411]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getWorld(CraftServer.java:1318) ~[patched_1.17.1.jar:git-Paper-411]
at gardened.pve.tp(pve.java:64) ~[PVE-1.0.jar:?]
at gardened.pve.onCommand(pve.java:58) ~[PVE-1.0.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-411]
... 21 more```
```java
tp(player, world, x, y, z);
``` is the line that's causing it
tp is defined here:
private void tp(Player player, String world, Double x, Double y, Double z) {
player.teleport(new Location(getServer().getWorld(world), x, y, z));
}```
I have this: saveResource("data.json", false); in the main file
and I have the file data.json in the resource folder but when i load the plugin i get
java.io.FileNotFoundException: plugins\RaidsPlus\data.json (The system cannot find the file specified)
any ideas?
@humble tulip any ideas?
spawn:
player: # where /pve will take the player
x: 100
y: 100
z: 100
world: "world"```
is config now,
show your whole code
That'll work
the main?
Where do u load the json
just the code that does stuff with the file lol
Before u save it?
It gives the error I sent above
,
Im making a mc server on a vps should I have a panel
idk
i cant decide
it is complicated to make the panel
U can use screens
we have to smell what you or doing or what?
ik
Idk what mojang mapping is lol, but I am trying to use build tools
Make sure Name isnt null. Done.
Are you sure that it is not fired for armorstands? Sysout the type to validate pls.
Im suspecting that the metadata packet afterwards just respawns the armorstand for the player.
I will try that
Yes I am. Even if I add a sysout, it will never be fired
It did not work
And did you add a sysout for the other spawn packet?
Yes, I tried for both PacketPlayOutSpawnEntityLiving and PacketPlayOutSpawnEntity but the PacketPlayOutSpawnEntityLiving is only fired for a creeper I have, the other is not even fired
Hey all,
this is probably a message you will skim over.
However me and my mate have an amazing idea for a project
however we are in need of a developer.
if this is something you are interested in then the idea can be
further explained in DM
there is a slight catch. me and this mate are both students.
money is not the easiest to come by. however we are devoted to this server
and would love to have someone join the team. and once the server has launched etc
money that we receive we will aim to provide you with money worth your time (dependent on server growth)
any questions or possible discuses the offer please DM me
Then you need to find out which packet is sent to tell the player that an armorstand was spawned.
https://wiki.vg/Protocol
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
nvm, I wasn't sending the destroy packet for the player so the armor stand wasn't despawning lol
If I create a nms entity and create a Bukkit entity, can they have the same id?
can someone help me out rq
well i have a network and for some reason this minecraft 1.8.8 server wont let me conntect through bungee
this is the error it throws when i try and connect
@quaint mantle u know?
how to get discord helper role
u have to recreate all of hypixels plugins in under 1 hour
common anyone
@covert karma
Hello guru Spigot tell me how can I disable logging of some commands?
Playercommandpreprocessevent
Cancel it
Get the command from the commandmap
And pass the args to the execute method woth the sender as the player
You basically have to handle command execution yourself
Maybe there's a better way to do it but that's how i would
If it's your own command, you can use playercommandpreprocessevent as your command executor basically
eat an entire horse with your pinky as a utensil in under 30 seconds
fuck can someone fucking help
bump
thats alot of fuck in one sentence
why isn't this working?
player.teleport(new Location(getServer().getWorld("world"), 100.0, 100.0, 100.0));
tried that, still nope.
How to make an item glow when a player is holding it but the glowing effect can only be seen by the player who's holding the item
ok
should be more a thing for admins only but its not really bad
i'd parse their input with some regex as people are idiots
what are you using it for actually?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thanks. I need to cancel the command and manually call the code that is being executed, right?
if you learn some basic sql it wont
Yep
Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap"); commandMapField.setAccessible(true); commandMap = (CommandMap) commandMapField.get(Bukkit.getServer());
If it's for another plugin, u can get the commandmap and knowncommands with reflection to call the method manually
^ modifying the command map only works during onEnable for some reason
He doesn't need to modify it
That also makes sense since plugins are initialized very early on
Maybe even before bukkit does its commad stuff
you sure?
because it's worked fine for me
I attempted to register a command after the first tick, and it simply didn't work
how did you do that
because I have a plugin manager
it can load plugins at any time, and their commands register just fine
by accessing the commandmap and registering stuff after connecting to Db
and they use my command framework which registers them through the command map
getCommand works, but messing with the commandmap is kinda icky
the commands that will be sent as tab completions don't get updated automatically
you have to call something else, I forget what it is
but to my knowledge you can still register commands just fine after the first tick
Odd
it would just not do anything in my case
It's a private method syncCommands in CraftServer
Could be that
Maybe someone knows what the team's color change is related to? No matter how much I searched, I couldn't find it
It's public
For example, when there is an error in the vanilla command, it turns red
U have to call that to refresh tab completions?
Yes
I was having a problem with tab completions being oresent after removing and unregistering commands
I assume this fixes it?
In 1.13+ it should
ConfigurationSection#getKeys(false)
Or change it to true if you want the entire config tree
Excluding map lists sadly
Curse you map lists, you make writing config libraries so difficult 😩
Look at the shit I had to do to get map lists working with my serialization lib
I had to make a wrapper that can wrap either a map, list, or config section to be able to read from and write to it from config
It's not like it was crazy difficult it's just that this shouldn't have been needed
All that's necessary is to make it possible to index lists with numbers
So:
thing:
- hi
- hello
- hey```
thing.0 = hi
thing.2 = hey
like it just makes sense
😢
Can you not just do getKeys(false) on the root?
YamlConfiguration is a ConfigurationSection
The hell
It 100% works
👍
do persistent leaves still call any log check events?
pretty sure
since a leaf that is player-placed and has a log placed or destroyed next to it will update observers
which is pretty funny lol
it's a form of instant redstone
a very powerful one actually
because it doesn't interact with any other redstone components except at the input and output
Is the ´e.getChunk().setForceLoaded(true);´ function persistent after reload/restarts?
so do you think I could use LeavesDecayEvent for persistent leaves?
and it is instant, long range, and can go in any direction easily
no
because player-placed leaves do not decay
I would only do this for the very first time and if you detect it once then you change the BlockData
*If you want to make generated leaves non-decayable
that's not what i'm trying to do but thanks for the tip
alright
Hi, I've a custom sign shop works with Interact and SignChange event
When i made a shop with a sign like this
First line: [Buy]
My plugins gives that line a color
and when i'm cheking for that in InteractEvent is a switch case for sign's 1th line, does not work! (needs the chat color too for the check)
Buy, sell and many other type of shops have different colors, what should i do?
use stripColor in teh switch statement
Sign is a PersistentDataHolder. Identify the customs signs not by their text but by their PDC
mca are nbt files
https://minecraft.fandom.com/wiki/NBT_format
You can take a look at apps like "NBT Explorer" and see how they read the files.
so what should i do?
how 😁
Identify the customs signs not by their text but by their PDC
So as 7smile78 said. tag each sign with a flag in its PDC.
but if you can't/don't want to do that you switch (ChatColor.stripColor(signtext))
thanks
sql
Save it to a File or into a Database.
Its persisted independent from the host. Meaning multiple server instances/applications can access it.
it can be indexed much more easily without loading it all into ram
Its easier to migrate your data. Queries are also a benefit. But all of that really only matters if you
expect thousands of players or several server instances.
It all comes down to what data you want to store
when my data plugin is disabled, it dumps records for all players.
when a player quits, their record is dumped.
many times when i stop the server, i get a concurrentmodificationexception.
any reason why?
because you concurrently modify a collection...
?
Probably something like
for(Element element : elements) {
elements.remove(element);
}
But we need more context.
sqlite vs h2?
You mean programmatically interact with the DB or how to install a DB on your host.
shooooot
*imagine a really hard facepalm, so earthshattering that the ground probably just shook in your country*
- A running Database
- The Driver for that DB
Just read through this:
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
what are you doing lol
so many people have lost progress due to a dumb concurrent modification
im making fallenmc
bruh what code is causing the error?
the error will tell you where its happening
no, i fixed it
how do i register other classes?
register?
what
Register where?
because everything i put in other classes just straight up wont work
?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.
ok so
?di I believe you are asking how to use the config and other bits in other classes.
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Im guessing you need to give yourself one or two weeks and learn the basics of java.
no
i put somthing in a second class, no errors, just didn't work. I put it in the main class no errors and it worked but i want it seperated
put what exactly?
@EventHandler
public void clicker(PlayerInteractEvent event) {
Player p = event.getPlayer();
p.sendMessage("testing");
Block block = event.getClickedBlock();
String bl = block.toString();
Material b = Material.matchMaterial(bl);
Location l = event.getClickedBlock().getLocation();
UUID u = event.getPlayer().getUniqueId();
String path = returnPath(b);
int upgrade = getConfig().getInt(path + "upgrade");
int give = getConfig().getInt(path + "upgrade");
if(b.equals(Material.WHITE_CONCRETE)) {
p.sendMessage("" + give + upgrade);
}
}
private String returnPath(Material b) {
String path = "NaN";
if(b.equals(Material.WHITE_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.ORANGE_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.MAGENTA_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.LIGHT_BLUE_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.YELLOW_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.LIME_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.PINK_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.GRAY_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.LIGHT_GRAY_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.CYAN_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.PURPLE_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.BLUE_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.BROWN_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.GREEN_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.RED_CONCRETE)) {
path = "clickers.clicker1.";
}
if(b.equals(Material.BLACK_CONCRETE)) {
path = "clickers.clicker1.";
}
return path;
}
public static HashMap<UUID, Integer> Balance = new HashMap();
public static HashMap<UUID, Integer> Clicks = new HashMap();
that
yes i was using implements listener
oh god what the fuck
That needs to be in a Listener class and you regsiter it
?
i have implements listner
Did you register an instance of your Listener with the PluginManager?
In your onEnable Bukkit.getPluginManager().registerEvents(new YourLiostenerClass(), this);
yes
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
getConfig().options();
saveDefaultConfig();
}```
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new YourListener(), this);
}
Do yourself a favour and check out some java basics tutorials. It will speed up your development big time.
Delete getConfig().options(); it does nothing
so, like this?
is that what you called your class?
Do yourself a favour and check out some java basics tutorials. It will speed up your development big time.
no it's just "clickers" for the second class,
then new Clickers()
This ^
using new Clickers()
im loosing my last braincells
lost
i just started java yesterday chll
i lost my last braincells many times 
Its ok no insult, we are just having fun at your expense 😄
Dont start with spigot. Spigot has a ton of unusual concepts.
Or be prepared for lots of ?learnjava messages 🙂
Its never said with ill intent though
and its saturday
Hey guys, could we somehow use the StructureType in order to remove something ? I'd like to make an event that moves the stronghold to another location 🤔
You can place a Structure, removing is unlikely
Do you have a tip on how to place it ? Can't seem to have a methode to create it ? 🤔
To remove it I could just look for certain blocs and remove them i guess
Read teh Javadoc it tells you how to get the Manager and use structures https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html
Can I run setTime() in a ASync runnable?
Oh yea my bad there is just a Structure interface lmao, I'm kinda noob with the doc, thanks a lot ! Have a great day/night 😄
Many things in the Bukkit API can be accessed Async, but its never recommended. Results may vary.
ow ok, thanks
How can I make the player not dismount the entity if he is spectating it?
cancel the dismount event
but he is on the spectator mode
If he can dismount then the event will fire
Something something ping events
^ sounds about right
at pl.botprzemek.handlers.JoinQuit.onPlayerJoin(JoinQuit.java:45) ~[?:?]```
how to get PlayerProfile?
for playerhead
what version of Spigot is your server running?
api 1.18
hm i want to use it on 1.18+ so, do i need to use deprecated setOwner or?
You just need to have your server running a new enough jar
i want to run this on 1.18.1 jar
then You can;t use PlayerProfile
Don;t need nms player, just authlib
?paste
to get it from a player you'd need nms no?
util class for skulls^
version independent
you shoudl be able to pull it from teh Players gameprofile
I'm trying to create a chunkloader that also spawns mobs.
With setForceLoaded(true); the Chunk keeps loaded but how can i get mobs to spawn there?
i just went with string playerName and setOwner ;D
That's blocking
Meaning it'll block the main thread causing lag
How can I make the spectator's name not have a low opacity and italic style?
why its blocking?
Cuz a req has to be sent to mojangs servers to get the texturees
can i change api without any errors then? xDD
Wdym?
U can use this tho
To set the skull
It's version independent
Oroblem is it doesn't work with names
So u gotta get the texture code urself
How can i get mobs to spawn in a forceloaded chunk without a player?
whole skin texture or only head?
wdym texture ;D
One sec
like that
3866a889e51ca79c5d200ea6b5cfd0a655f32fea38b8138598c72fb200b97b9
or just that
or even the base64 of it
eyJ0aW1lc3RhbXAiOjE1ODM2ODg4ODAzMTcsInByb2ZpbGVJZCI6IjkxZjA0ZmU5MGYzNjQzYjU4ZjIwZTMzNzVmODZkMzllIiwicHJvZmlsZU5hbWUiOiJTdG9ybVN0b3JteSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjlhNWM4MGE3ZTUyZjc3MDc3MDE5ODNkMzFiOWRlMzU2YzJjNzBkYzE0NDEwNTIyMjlkOGJkMDQ1MDRiZmMxNSJ9fX0=
like this
bump 🪂
also quick java question
public class StatsMenu extends SubMenu {
private ArrayList<Pane> panes = new ArrayList<Pane>();
If i do this will the panes array be the same for every object from this class or no
only if you make it static
is it evaluated at run-time or every time when an object is created
no it will be different for every instance of StatsMenu
maybe do getNavigation.moveTo(Path, double)
i think the double is the speed
ive tried that
what happens?
anyone know how to get the top half slab of a oak block?
or just top half slab in general
my bad, it works now
there was something wrong with maven
thanks
getBlockData cast to Slab
is it possible to check if the horse can make it to the target position? For example I've set this horse to walk 10 blocks in the positive x direction and it ends up walking around the wall and then gives up half way through
i wanna be able to check if it wont "give up"
also sometimes the horse will find a new target halfway through
how do i prevent that
what event is called when leaves change their distance value?
i've tried blockphysicsevent but it didnt work
@ornate patio you need to make sure no goal is overriding with the navigation, also check if its stuck, then you might wanna try to re-invoke move to or sth
how do i do all that
idk much about nms
Explore it a little bit then? Read how mojang wrote their navigators, as well as goals
Smile gave you the hint, but in case you didn’t get it, ServerListPingEvent
Look thru the methods u can invoke when u getNavigation
And look through the goals of said entity, there is a high plausibility they interfere with the navigation during normal occasions
Too bad

alright
thanks
appreciate it
print the string and check if it is over 30
Nope it’s not possible
What about a material
No
No
..
got it
Is there a way to automatically update the server? As I'm going to be using the new paper 1.19 release I'd like to have future fixes be added on their own
or would I need to make a script running alongside the server to do that for me
and restart the server periodically
You would have to… yes
ic
Myeah I mean that’s the safest way to do it Ig
And then, ofc create some back ups every once in a while
you really should not have that sort of thing done automatically
there could always be zero day exploits or breaking changes
and you would blindly update (if you'd consider something like this, no doubt you'd forego proper logging) and potentially break things and not really be able to know why
Im getting an error when I cast it,
Any ideas why?
Hmm let me try something
am I going insane ```java
[02:10:55 ERROR]: Could not load 'plugins/Tazpvp.jar' in folder 'plugins'
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ProtocolLib]. Please download and install these plugins to run 'Tazpvp'.
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:286) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:412) ~[paper-1.19.jar:git-Paper-8]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:278) ~[paper-1.19.jar:git-Paper-8]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-8]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-8]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
I removed protocollib from my pom.xml
You need to remove it from your plugin.yml as well.
smarttttt
Or change it to a softdepend
I forget about plugin.yml
Is there anyway to spawn/do the warden's attack
how do i get the goals of an entity
also how can i get the nms source code to use as a guide
decompile server jar
how do i do that
use something like jd gui
IntelliJ/Eclipse have plugins (I think IntelliJ might have it built in?) to decompile code
I've used that in the past to look at nms and it worked pretty well
there's probably an extension for vscode as well somewhere
try searching in the extensions tab
or that yeah
isnt that an eclipse plugin
yeah because the jar doesnt contain the classes for development anymore
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
where do i download this
build tools
in the buildtools dir
there should be a jar that is generated which has nms and spigot api
it'll be under like spigot-server
Good nigh, im havin some troubles on my command api because on my custom Command class i need an instance of my plugin
But i cannot figure which is the best way to pass the instance
I need to pass an instance from a message api
yea you can get the block connected to the face
oh snap
how do you do this?
Why the heck when im doing class#getMethodName() it showing the super class when the @Getter is set to some fields
Really weird
hmmm i think im going insane
what do u mean?
the relative face of the relative face?
how could I stop leaves from changing distance blockstate
Does anyone know about registering and unregistering commands via the commandmap?
I'm having a problem where if i unregister a command from the commandmap that had overwritten a mc command, and i try to execute the command, it says that it's not a command. I printed the contents of knownCommands and I could not see any minecraft commands there by default. I'm confused as to why simply unregistering the command doesnt allow the vanilla functionality to return
public void register() {
try {
for (Command command : this.commands) {
if (!this.getCommandMap().register(this.plugin.getName(), command)) return;
command.unregister(this.getCommandMap());
this.getCommandMap().register(this.plugin.getName(), command);
this.plugin.getLogger().info("[Core] Registered " + this.commands.size() + " commands");
}
} catch (Exception ex) {
this.plugin.getLogger().severe("[Core] Failed to register commands. Reason: " + ex.getMessage());
}
}
public void unregister() {
try {
for (Command command : this.commands) {
if (!this.getCommandMap().register(this.plugin.getName(), command)) return;
command.unregister(this.getCommandMap());
this.plugin.getLogger().info("[Core] Unregistered " + this.commands.size() + " commands");
}
} catch (Exception ex) {
this.plugin.getLogger().severe("[Core] Failed to unregister commands. Reason: " + ex.getMessage());
}
}
CommandMap getCommandMap() throws Exception {
Field field = this.plugin.getServer().getClass().getDeclaredField("commandMap");
field.setAccessible(true);
return (CommandMap) field.get(this.plugin.getServer());```
yeah but let's say i register msg and then unregister, I dont get minecraft's msg command working again
Oh minecraft command?
tried printing the contents of knownCommands but it's not there
I never unregistered a minecraft command
Is there a way to mass modify player NBT data?
I'd like to set all the players positions back to spawn
And so far
going through one by one
is gonna drive me mad
for loops?
are u doing it for a plugin or just wanna do it as a one time thing
One time thing
I can write up a script but if there's a tool already out there for it I'd rather do that
it's best u write a script
also I'm not sure how I would go about read/writing to it
as you can't even view it in visual studio code without an extension
want me to write something for u?
Ima be wrong but intellij is shity today for me
that'd be gr8, but send source lol
thanks
dw i wont nuke ur server
minion?
ye?
Do you have any idea?
I mean its a fresh server atm so you'd be nuking a desert in equivalent
java version?
lol
17
then idk
thought it was some weird thing
with java version in intellij being like version 7
that happens to me randomly
Is there a way to cancel certain advancements from occurring?
Hmn suddenly got fixed idk
The advancement done event doesn’t have a setCancelled option
Goodbye loves see you soon
data is saved in world/playerdata right?
yea
finished it, just testing now
damn
more of a math question here
I'm looking at the NMS source code and I found the functions used to randomly generate horse speed, jump strength, and max health
why is this so weird though
and is it any different than what i have:
Is there a way to have custom blocks use custom textures kinda like how the wooden hoe trick works?
yea just some texture pack finicky
it can take a bit to get everything going smoothly but its fun to screw around with that stuff
wtf is "RunAroundLikeCrazyGoal" lmao
would I just do the same trick as the wooden hoe or what? I'm not really sure how it'd work since blocks don't have durability in the way that tools do
why would you use durrability
what version are you using
probably when you hit a npc and it starts running around?
that's what's used for custom items. Not sure what the equivalent would be for blocks. I'm using 1.18.2
yeah its just a weird name
🤷♂️
no you don't have to use durability anymore thats pointless. I don['t think you've had to use durrability for a long while
Use ItemMeta#setCustomModelData
it takes in an integer and can be linked to resource packs
now you can have players use there tools like normal
instead of throwing away tools for an arbitrary purpose
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
I had been looking at this forum post:
https://www.spigotmc.org/wiki/custom-item-models-in-1-9-and-up/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thats super outdated
run away
https://www.spigotmc.org/threads/texture-pack-prefix-logo-on-scoareboard-tablist-chat-etc.557111/
https://www.spigotmc.org/threads/advanced-resourcepack-mechanics-how-to-create-custom-items-blocks-guis-and-more.520187/
Hello Everyone, I just want to show to those who don't know how to add their server's logo on the Scoreboard or even an image as a prefix how to do it....
Thx!
lol
it is different
think of it like this
if u roll 2 6 sided die, the probability of outcomes is different to rolling one 12 sided
they probably wanted some kinda variance
normal distribution?
for my Bungeecord Plugin
I got a purgatory list with many player uuids, any player that join the server whos on the list will be sent to the purgatory server
what would be the proper way of doing this
how large is the list?
should that matter?
well if it's a few players maybe store em in a file which you load on enable
and cache to a map/set
so u can check
if it's a lot of players, use a database and check the database when they join
idk if its even necessary to cache if your immediatly redirecting them too be completely honest
Im more asking HOW I could send them to the purgatory server, not how I could check if they are in the list
so u dont load a file every time a player joins
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
just player.connect?
yep
hmm, what join/login event can I use this in?
i think a few login events dont work
maybe the PostLoginEvent?
yeah try that
I have a JSONObject and when I write it to a json file it's all in one line.
is there a way to make each key and value in a separate line?
something with pretty
I was hoping I could re-route them before they joined the main lobby, like telling them to join the purgatory server in the first place
are u using gson?
postlogin is before they're connected to a server
I see
but after they login
alrighty, imma try that
json.simple
may i ask why not gson?
GSON will have you covered with prettifying with Simple Json its all hacky methods
idk
isnt gson also in spigot by defualt?
it is
alternatively if you're quirky you could use jackson
https://stackoverflow.com/questions/4105795/pretty-print-json-in-java here is a resource on how to use the prettify from gson since I'm assuming your switching at this point
why switch?
well i'll just backup my project and then try
Shouldn't be hard to swtich at all
wait but i have this private static JSONObject obj;.
what would it be in gson?
JSONObject is in json.simple
in what world do you need a private static uninitialized JSONObject
do you have a static constructor?
No need to instantiate this class, use the static methods instead.
what does this mean
Use JsonParser.parseString(java.lang.String)
found this in hte java doc
JsonObject convertedObject = new Gson().fromJson(json, JsonObject.class);
u can probably also do ^
this might be the ideal solution
thats what Gson deprecated says to use instead of the deprecated JsonParser object
they changed to a static builder design
and in here file.write(obj.toJsonString());
how do I write this obj to the json file?
i have this also Gson gson = new GsonBuilder().setPrettyPrinting().create();
gson.toString maybe
I forgot
Haven't used anything with json in a while
Or maybe toJSonString
ok i got it
how do I get a JsonElement of an integer?
(the integer is not in the json file)
anyone here know how I may be able to stop leaf blocks from updating the "Distance" blockstate?
for what reason 🧐
to stop the distance blockstate from updating 😂
nah but fr so I can add custom leaves
you can use blockstates to add models for specific distance blockstates on leaves
makes sense
sadly you can't just cancel blockphysics
i guess whenever a leaves block decays
you can iterate the leaves attached
resetting them to their initial value
tho
i highly doubt this is efficient in large quanitites
the value doesnt just change when a leaf block decays
and I feel it wouldn't be efficient to search through every leaf block everytime a player places any log near them
I tried searching online but I wasn't able to find anything
apparently not a common issue. 😅
it says I can't do JsonObject.add(String, int) because obj is null (has nothing in it).
how am I supposed to add anything to it?
Error
Error dispatching event PostLoginEvent(player=Teleputer) to listener me.teleputer.purgatory.listeners.PostLogin@7ca33c24
java.lang.NullPointerException: Cannot read field "configuration" because "this.plugin" is null
in PostLogin.java
private Purgatory plugin = Purgatory.getInstance();
@EventHandler
public void postLoginEvent(PostLoginEvent event){
ProxiedPlayer player = event.getPlayer();
System.out.println(plugin.configuration.contains("Purgatory."+String.valueOf(player.getUniqueId())));
}
and in Purgatory.java
private static Purgatory instance;
public static Purgatory getInstance() {
return instance;
}
private static void setInstance(Purgatory instance) {
Purgatory.instance = instance;
}
I dont know why, but plugin is Null in PostLogin
PostLogin is initialised before your instance variable is set.
You should avoid abusing static like this and follow a dependency injection structure.
just following a tutor
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
so I pass the plugin in the registerListener?
getProxy().getPluginManager().registerListener(this, new PostLogin(this));
and
private Purgatory plugin;
public PostLogin(Purgatory plugin) {
this.plugin = plugin;
}
like so?
yes
any ideas?
you should pass most things like this excluding utility classes
little hint with DI is when making Util classes that require a JavaPlugin param you can actually pass in the generic JavaPlugin versus your instance Purgatory which will make your utils much more portable
this works because of polymorphism and is just a neat tip you should know
anyone?
thats gonna be helpful
what is obj?
JsonObject
Can you show your code please
did you initialize the JsonObject?
public void badOmen(RaidTriggerEvent event){
JsonElement element = JsonParser.parseString(String.valueOf(event.getPlayer().getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier()));
obj.add(event.getRaid().getLocation().toString(), element);```
there's no initialization for obj in that code
are you sure you didn't forget to initialize obj
where is obj assigned a value
here
I want to add a key and a value
hey, im gonna create a variable but assign no value to it
??????
whats this? i cant use my variable because it has no value?!?!?
I WANT TO ADD VALUE
why are you being rude
that's considered being rude?
you need to set obj to a new JsonObject or however you create one of those.
good luck in this server my guy or any help server in general
he's mad!
US east is +4???
or -4
wait does that make me UTC+3 or UTC+5 idk how the fuck UTC works
utc is gmt
It's 2:55am and I'm utc - 4
yeah same
its actually 1:55am idiot
Ur utc - 5 then
😂😂
😹
Well atlesat I have a lot of options to go to different really shitty cities and get shot because of the high levels of uncontrolled crime because of miss managed services
:)

Sounds like a bunch of shittu options tho
Chicago is nice
Us is a shithole
false its nice here as long as you stay out of any city and don't watch the news
and don't talk to anyone
whatever you do don't go to california
no its, its 👀 its very high taxes
ahhh then you should go to buffalo NY during the winter
Ny will probably be nice
NY has lots of agriculture
Nyc?
Wait how big is ny compared to nyc
@Contract("null -> null")
public static @Nullable @Colored String[] translateArray(@Nullable @FutureColored String @Nullable ... messages) {
Huhhhh
I'd like a more blurry photo pls
I've got no idea what I'm looking at
on Bungeecord, how can I get the UUID from a Players name
I have this private static JsonObject obj = new JsonObject();
and this is where i add value: JsonElement element = JsonParser.parseString(String.valueOf(event.getPlayer().getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier())); obj.add(event.getRaid().getLocation().toString(), element);
and this is where i get the value: try (Reader reader = new FileReader(plugin.getDataFolder() + File.separator + "data.json")) { JsonObject jsonObject = (JsonObject) JsonParser.parseReader(reader); return jsonObject.get(key).getAsInt(); } catch (IOException e) { e.printStackTrace(); }
Why does it say java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsInt()" because the return value of "com.google.gson.JsonObject.get(String)" is null?
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?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.
?
thx
what is key?
a string
ok yes, but where are you getting it from and have you checked what it is
hello
getting it from a function and yes i did check
so ive got a couple plugins that I want to use a currency with
