#help-development
1 messages · Page 1503 of 1
whats the warning?
Wdym by warning?
put the mouse on top of the getType
it is not warning
you see how it has a yellow thing on getType
.
cuz you forgot to check
if its null
if (clickedItem == null || clickedItem.getType().isAir()) return;
what are you trying to achieve actually
When a player exists a custom GUI (I made a custom anvil gui to combine) it gives him his items back
thought the original code would work, dont have to combine them into a predicate
original as in splitting into two
if you created the inv then you should check if the inv in InvCloseEvent is the one you created
I know it is
it checks if it has a custom thing in the name
yes but you are chekcing the title
yes
you can check the inv instead
I know it works because for Item1, when i put an item in there and close it it works
but when I put item2 and no item1, it reutrns nullpointerexception
when you do
Inventory inv = ...
on invClickEvent
if (event.getInv != inv) return;
yes yes checking the name will work
but its not recommended
if (item1 != null && item1.getType() != Material.AIR){
....
}
if (item2 != null && item2.getType() != Material.AIR){
....
}
this
just saying
can you send the current code again?
there might be a detail missing
ohh, that's because you asserted it to be, but in reality might not be
for example it would have failed before even reaching that line
there is a reason why it even got removed in later versions iirc
don't so assert
ok
use*
dont use titles to compare inventories, use InventoryView
its because item1 is null...
Cuz item1 might be null
I fixed it by asserting it
so basically, if an item is null, you cant call any methods on it
Asserting doesnt fix anything
do you know what assertion means?
when its null
ok
assertion -> a confident and forceful statement of fact or belief.
he might still have code to run after
this isnt anything confident
then dont return
&& item != null
java checks in order
and if that is false
then it just doesnt go through the next check
Finally it works
I always tought it was the check for null in the player.getinv.additem
but it was actually in the pane check
ty <3
nice
On Maven, what is the Source version supposed to be for minecraft 1.17?
does anyone know how to use the mojang mappings when developing plugins?
after you use buildtools to build 1.17,
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
I have that. But what is the maven source and target?
Right now it's set to 1.8 for me but that should be Java 8. For Java 16, 1.16 doesn't work
Not sure if I just don't understand or it's busted on my side
1.8 worked for me
should be alright
Hey @sullen marlin apparently my plugin was taken down as it had the hypixel branding in the name. Yes I do admit it's my mistake, but it wasn't taken down without any warning whatsoever?
Hmm from what I have seen resources get taken down without a warning if they break any rule.
Ouch
Pretty bad
It's been up for a year and gained quite a bit of popularity. Kind of pissed off by the warningless action
Yeah I mean personally I believe a warning or just block public accessibility until the issue has been resolved would be better but yeah, it is what it is.
I didn't realize how many extra api methods paperspigot had until I was forced to use spigot for 1.17
My crafting recipes kinda stopped working for no reason at all, some people told me it's because of the namepsacedkey.minecraft but im not sure.
How come when /reload is executed the config resets kinda like if something is set false it set to true but in config its still false?
A lot of them are just deprecation in favor of adventure
Why aren't you using your own namespace
I also looked up some tutorials and they all seem to fail
I followed a tutorial to redo my crafting recipes after they stopped working, and that's what the guy said
Ok
Make sure you're placing the pearl in the center
i just set mine to 16 and it seems to work
If I was making an enchantment that lets the user fly, what would the best event be to check if the user has the chestplate?
Replaced minecraft namespacedkey with my own, seems to work now.
I keep getting an internal error occured
To stop any possible exploits, bugs, etc.
?paste the error
No console messages?
get verified then you can post images
Send the error ;/
An internal error occurred while attempting to perform this command
package me.ebow;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Commands implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
Player player = (Player) sender;
if (!(sender instanceof Player)) {
sender.sendMessage("console command error");
return true;
}
if (cmd.getName().equalsIgnoreCase("ebow")) {
player.getInventory().addItem(new ItemStack[]{item.Explosivebow});
return true;
}
return true;
}
}
commands class
Yeah the full error from the console...
at org.apache.commons.lang.Validate.noNullElements(Validate.java:364) ~[patched_1.16.5.jar:git-Paper-771]
at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory.addItem(CraftInventory.java:293) ~[patched_1.16.5.jar:git-Paper-771]
at me.ebow.Commands.onCommand(Commands.java:21) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-771]
... 19 more
Item cannot be null
Well looks like item.ExplosiveBow is null
yea
addItem(@NotNull)
im trying to update my plugin to java 16
why am i getting a 'process terminated' when the only thing ive changed is the pom?
my pom.xml:
?learnjava This is useful..
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I see 2 issues, one being the fact that you cast to Player before checking and the other being that as Olivo said item.Explosivebow is uninitialized thus its null.
But then it shouldn't compile 👀
no i didn't
private static void explosiveBow() {
ItemStack item = new ItemStack(Material.BOW, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("Explosive Bow");
List<String> lore = new ArrayList<>();
lore.add("Arrows blow up");
meta.setLore(lore);
item.setItemMeta(meta);
item = Explosivebow;
}
public static void init() {
explosiveBow();
}
}
here is my item manager class
i did
idk if it causes your problem, but afaik with jdk 9+ you should use
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
static init block my buddy
got that at the end
the maven compiler plugin already has this defined
oh, discord didnt load the end so I cant see it
that is correct?
You have two properties blocks, this is no good. Though idk if it causes this issue
class Dope {
public static final ItemStack STACK;
static {
STACK = new ItemStack(...);
ItemMeta meta = STACK.getItemMeta();
meta.setLore(Arrays.asList("Boo!"));
STACK.setItemMeta(meta);
}
}
@vast sapphire You can avoid manual static initialization with something like this, although since ItemStack is mutable you should probably prefer a factory method.
oh
now its Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ItemBlacklist: Fatal error compiling
any more info?
do you have java16
I like how many issues java 16 has caused
nope, thats all it tells me
Your setup is cursed
You can refer to towny's pom
what is the result of mvn --version
OH MY FRICKING GOD IM DUMB
I do not know what is wrong, other than that something is wrong and is basically intercepting all issues
downloaded 16 but didnt set it to 16
nice one
Lmao
also quick question do i have to change anything for the plugin to work with 1.17 or is spigot backward compatible
If you use nms, yes you have to change sth
Assume one only depends on Spigot API, in that very case you can pretty much launch your plugin at any 1.17 spigot server.
Most 1.17 plugins only support 1.16.5 and 1.17, nothing before
However you could just not bind into 1.17 and still compile with Java 8 - 15 and allow previous versions to use the plugin
i dont
What do you mean by bind to 1.17
Nmv, misread
Compile against
I think even if you depend on 1.17's api, the plugin can still work on older versions
Basically, no most times yo do not need to change anything, provided that you code stuff correctly
I think you need J16 in order to bind against 1.17, which cannot be used by older mc versions. Though I do not know if I could still set the release version to a lower version, if that is possible then that my rant can be ignored
Yea you can still use 1.8 to compile 1.17 dependencies
anyone have any ideas on this?
https://github.com/Multiverse/Multiverse-Core/issues/2640
looks to me to be a Spigot or MC bug
yeah it's the latest
Try submitting a bug report on JIRA
1000% not a MV bug. I saw it in earlier versions when starting my world on my local server
I never got around to making a JIRA issue for it because I've been preoccupied with work and school
Is there a way to detect /reload ?
yes
whats the difference between BARRIER and LEGACY_barrier?
in your onLoad() method check for how many worlds are in Bukkit.getWorlds() If its empty its a fresh start.
Ahhhh ok thanks
I have this code:
private Skull changeSkin(Block b, String base64Str) {
final Skull skull = (Skull)b.getState();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", base64Str));
try {
Field profileField = skull.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skull, profile);
}catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); }
skull.update();
return skull;
}
and it gives me this error:
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState cannot be cast to class org.bukkit.block.Skull (org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState and org.bukkit.block.Skull are in unnamed module of loader 'app')
Now the problem is that I have the exact same code in my other plugin and there never were any errors with this code
The error points on this line:
final Skull skull = (Skull)b.getState();
Now about my imports, i dont have any imports associated with blockstate
So im not sure where this weird craftblockstate import comes from
it should be just normal bukkit import like the skull is, but it isnt
The block isn't a skull
Is there any way of changing an inventory title without creating a new one?
(I dont want to fire InventoryCloseEvent)
Uh you probably have to reopen a new inventory with the desired title or reopen another inventory view
?
Will opening another "view" trigger a closeInventoryEvent? Because that's what i dont want
b.getState() does not instance of Skull @vital ridge
to use vault as an maven dependency do i need to include it in my pom.xml?
Yes
Hmm I don't think
Just opening one shouldn't trigger it but can't promise anything
well i have this now and doesnt work
<!-- Vault API -->
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
</dependency>
an instance of BlockState has no guarantee to be the type of a Skull
So what should I do?
I still dont understand my error
CUz the same code worked perfectly in my last plugin
where i did the same exact task
should I check something?
It just means the block you're passing isn't a skull
Should I be storing kills & deaths in a database so I can use them?
Sure jtx
@vital ridge a simple
if (!(b.getState() instanceof Skull)) {
return null;
}
Skull skull = (Skull)b.getState();
should fix it
?paste
aight
Did you add the repo?
I was thinking of using json but I don't know if thats efficient
im wondering where to find it
Plain files jtx?
wym?
https://github.com/MilkBowl/VaultAPI @tardy delta
is it this
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
No it's on jitpack
jtx saying you wanna store it in json is kinda ambiguous, for instance you can use plain files to store data using json format but for instance MongoDB also uses a json format to store data I think.
Since im making a custom anvil to combine my items, I don't want to remake the vanilla one since it'll be wayy too complex and take wayy to long. so I've placed that. It opens the right GUI but whenever i try and use it, any items gets deleted and it sends and error in my logs. Maybe it's because it has no block associated with it? Any fix?
My plugin doesnt open custom anvil when i use a damaged anvil, and when I tried that, it works just fine.
sending the error would be a good start
i dont find what to write for the repo of vault
hm
jitpack is just jitpack.io
Not supported yet?
How would i be doing it with plain files?
Using plain files I would probably start by choosing a Java json library, ideally gson since it’s shaded. Have you messed with writers and readers or is this your first time (not particularly hard)?
first time
The real question is, do you need a database?
Yeah you could probably use PDC to store data
Are you looking to track player vs player kills, or mobs?
If mobs, the API already has STATISTIC
Well what I was planning was storing their kills and deaths so I can grab them and display them but also use it on a leaderboard and to get their killstreak
these kill/deaths would be for all time or reset when?
BlockEvent does not have a getHandlerList() method so i am getting this error (i am not using BlockEvent directly)
all time
Then just use teh Statistics https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Statistic.html
it has deaths and entity kills
and player kills
but with statistics Im not able to get their kill streak
a kill streak is only going be over a certain time, so you can easily track that
you read the total kills at teh start and read them at teh end
what's with you always saying teh
Can anyone help me on how to open a vanilla anvil GUI?
When i simply create an inventory it glitches out and nothing works.
BlockEvent is abstract, what are you trying to do?
If I were you I would use a premade library for anvil GUIs
i am not using BlockEvent i am using event's that extends BlockEvent that it gives that error
How do I do that? I never used librairies
did you write those events?
You're using Spigot 👀
yea...?
This is my class https://paste.md-5.net/tevihilixe.cs
Which is a library
that's not where the error is thrown from
it gives from there and i sended InGameListener class
Well how do I install other librairies
PvPMask.java:81?
its that
and registerListener method is working properly
The same way as you did spigot
change BlockPistonEvent to BlockPistonExtendEvent and BlockPistonRetractEvent
and yes, I did add the repo
BlockPistonEvent is abstract
ok
how do i stop saveConfig(); deleting stuff
be a bit more specific
saveConfig will just overwrite your config.yml with whatever is loaded in memory + whatever changes you made to it
i have a configfixer like so
package me.outsparkled.itemblacklist;
import org.bukkit.Material;
import org.bukkit.plugin.Plugin;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class ConfigFixer {
public void fixConfig() {
Plugin plugin = ItemBlacklist.getPlugin(ItemBlacklist.class);
plugin.getConfig().options().copyDefaults(true);
plugin.saveDefaultConfig();
List<String> bannedBlocks = plugin.getConfig().getStringList("banned-blocks");
List<String> bannedItems = plugin.getConfig().getStringList("banned-items");
List<String> fixedBannedBlocks = bannedBlocks.stream().parallel().map(Material::matchMaterial).filter(Objects::nonNull).filter(Material::isBlock).map(String::valueOf).map(String::toLowerCase).collect(Collectors.toList());
List<String> fixedBannedItems = bannedItems.stream().parallel().map(Material::matchMaterial).filter(Objects::nonNull).filter(Material::isItem).map(String::valueOf).map(String::toLowerCase).collect(Collectors.toList());
plugin.getConfig().set("banned-blocks", fixedBannedBlocks);
plugin.getConfig().set("banned-items", fixedBannedItems);
plugin.saveConfig();
}
}```
and the config values i dont change just get deleted
try calling reloadConfig before accessing your string lists
don't remember the specifics but some things aren't loaded from the config file when trying to get values out of it during your onEnable
?jd
i see
so calling reloadConfig ensures that the values in memory are current with the file
ok thanks man!
and what If I wanted the user with the most kills?
getOfflinePlayers() and check their stats
How can I hide an Item's enchantements
Nvm I found it ITEMMETA_EXAMPLE.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
playerConnection not found, what should i use?
One message removed from a suspended account.
One message removed from a suspended account.
Hey,
does anyone know how I can get the root folder of my linux server in my plugin?
I want to create a file on my website, which is at a completely different location.
One message removed from a suspended account.
The users running your server shoudl not really have access to the root
tbh I don't really know how I could do that
Probably the safest way would be https://www.howtogeek.com/287014/how-to-create-and-use-symbolic-links-aka-symlinks-on-linux/
Hello! I'm trying to make a playSound event but it only play it in the location of the player, how I can make it for playing it in the entire world?
(It's a death sound)
Loop all the players
world.playsound
Or that
....
I'm a noobie
World needs to be a world
don't be dumb
World world : ?
?learnjava Highly recomnend
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.
that also doesn't make the sound global
so... how?
i don't know how to make a sound global tbh
bruh
i have hardly ever used sounds in my plugins, let alone global ones
look up a forum thread or something
I did it
I think looping players is the only way
in the 10 years bukkit has existed I'm sure you're not the only or first one who's trying to do this
read the java tutorials that were linked
few seconds
?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.
here's a video playlist if that's your thing
Join our community below for all the latest videos and tutorials!
Website - https://thenewboston.com/
Discord - https://discord.gg/thenewboston
GitHub - https://github.com/thenewboston-developers
Reddit - https://www.reddit.com/r/thenewboston/
LinkedIn - https://www.linkedin.com/company/thenewbostoncoin/
Facebook - https://www.facebook.com/then...
semi outdated given that the oracle JRE is hard to obtain nowadays
the new boston the beast
ever tutorials
?
has some issues though @wary harness
explaining the "this" keyword for example 👀
all tutorials that I've seen are incredibly lacking in the oop department
imo that's the first thing that should be done away, the concept and the layout and structure of a project, before you write a single line of code
ah but u can learn a lot
there are so many people who can write a script, write code, but can't for the life of them write a program
with tutorials about tuna
there's this https://www.youtube.com/watch?v=luggwIg0w2c&list=PL_c9BZzLwBRLW7Kw8bqc_PJqAnjCJI63P but it's short so far @wraith rapids probably missing stuff too
Check out Diffblue! https://calcur.tech/diffblue
Python Bootcamp - https://www.codebreakthrough.com/python-bootcamp
💯 FREE Courses (100+ hours) - https://calcur.tech/all-in-ones
🐍 Python Course - https://calcur.tech/python-courses
✅ Data Structures & Algorithms - https://calcur.tech/dsa-youtube
✉️ New...
and his exse girls
at least it has oop in the title
This?
xd
Books are a good alternative, though I guess they are outdated by todays standards
Bukkit.broadcastMessage(ChatColor.DARK_RED + "¡" + p.getName() + " HA MUERTO!");
players.playSound(p.getPlayer().getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 1); ```
yes, better
you are
But it only plays it on the player location
p. needs to be players.
for (int i = 0; i < x; i++) {/* code */}
thanks
yes, it plays for each player at that player's location
Why is he looping over all players? World has the method that plays to all.
I thought that was what he wanted
for (Player players : Bukkit.getServer().getOnlinePlayers()) {
Bukkit.broadcastMessage(ChatColor.DARK_RED + "¡" + players.getName() + " HA MUERTO!");
players.playSound(players.getPlayer().getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 1);
is correct @mystic terrace
Okay so, you need 5 stacks of 32 diamonds placed like a plus in the crafting table. And when you pick the result it takes away all 32 diamonds from all 5 stacks. like in hypixel skyblock. how can i do that in 1.12.2?
by updating to 1.16
I had this one all the time
or i guess 1.17 if you're feeling extreme
Lemme record a video and I'll send it
I think that you can understand it better my problem
i won't watch it
i really want to update to 1.16 but my pc is trash
shared hosts are cheap
you can get a server that outspecs your machine tenfold for like 1 dollar 50 cents a month
you can install viabackwards and play on a 1.12 client
Hmmph you are right
Someone can help me please?
what is the issue
I told you before
tell it again
example?
I want to make a playSound event in the complete world in a death event
your code does that
And i sended a video of what happened
.
Why?
my client doesn't support playing video
Is spigot is working on world generation also ?? As in vanilla there are no lush cavs and drip stone caves generation
you mean when you move, the sound seems to stay in one position
Yes
try increasing the volume to like 100 or something
Like, what*
$10/month on the higher end of the scale
sure, but still outspecs your crappy laptop tenfold at $1.5/month
damn stuff is cheap nowadays
i mean like what hosts?
It works, thanks ^^
some better shared hosts include dedicatedmc and heavynode
Btw on Spigot is there some way I could publish a JAR which is built with Java 8 for 1.14 to 1.16, and also provide a JAR built with Java 16 for 1.17 and higher? (Similar to CurseForge)
You might be looking at multi-release jars
Don't ask me how you can do that, you would need to search that for yourself
more realistically, and what people usually do, you just have a big bold dark red text in your description telling people to download specific versions for specific server versions
Isn't Java 16 retro compatible with Java 8 anyway ?
which nobody then reads and proceeds to rate the plugin 0 stars
(If you don't use new things about this version)
yeah ^
I found the JEP for multi release JARs and gonna look through the gradle blog for it
Does anyone know how to make a world with a larger height limit in spigot api 1.17?
Does anyone know what the new PacketPlayOutWorldBorder 1.17 package is new?
Can Bukkit#getPlayer(String) return null if player with that name never joined the server?
think all the packets are in net.minecraft.network.protocol.game
getPlayer will return null if the player is not currently online
oh, I thought it would return as OfflinePlayer, now that I think about it, OfflinePlayer cannot be casted to Player
It can be casted
Player extends OfflinePlayer
Correct
yeah, you can cast it, but only if you check it's a Player first
But casts can be done both ways
every Player is an OfflinePlayer, but not every OfflinePlayer is a Player
the method you're looking for is getOfflinePlayer
hey what does that mean?
java.lang.NullPointerException: Cannot read field "type" because the return value of "net.milkbowl.vault.economy.Economy.withdrawPlayer(org.bukkit.OfflinePlayer, double)" is null```
but OfflinePlayer does not extend Player
yes, but an OfflinePlayer might be a Player
a rectangle might be a square
if its sides are the same length
If the player is not online there never will be a Player object
similarly, a Fruit might be an Apple
cancelling note block powering by redstone?
an Apple is guaranteed to be a Fruit
and any Fruit could be an Apple
but only some Fruit's are actually Apple's
Wise words
interesting
i'm a pretty wise guy
Hey guys, i was wondering if anyone could help me out.
I'm new to asynchronous programming and can't seem to figure out why this permanently stucks the server:
private final ConcurrentHashMap<String,CompletableFuture<String>> testMap = new ConcurrentHashMap<>();
public void testProblem(){
final CompletableFuture<String> testString = new CompletableFuture<>();
testMap.put("test", testString);
new BukkitRunnable(){
@Override
public void run() {
testString.complete("test value");
}
}.runTaskAsynchronously(BlocksEvolved.getInstance());
try {
System.out.println("Test String is: "+ testMap.get("test").get());
} catch (InterruptedException | ExecutionException ex) {
Logger.getLogger(StorageProblemTester.class.getName()).log(Level.SEVERE, null, ex);
}
}
btw I like your username
aw, BlockPhysicsEvent e.setCancelled(true) is working for me
no, the only method im using is testProblem
you are
"Test String is: "+ testMap.get("test").get()
you are getting the future
and then blocking until the future is complete
yes, but that should just wait for the async runnable right?
yes
but it never gets completed
but the issue is
that you are waiting on the main thread
the bukkit scheduler is controlled by the main thread
if the main thread stops, no tasks will be run
does anybody know?
but doesn't the asynchronous task run on another thread?
yes
but it's controlled from the main thread
only the running is done on another thread
the ready-start-go is done on the main thread
yeah, but the ready start go is done before get isnt it?
it's not
ready start go is done in between ticks
ready start go is done as the first thing before a tick
i see
before or after plugins fire their logic
how can i prevent this scenario, any idea?
generally, do not block the main thread
but i do need to block the main thread
use a dedicated worker thread
because some event handlers need this info
that is separate from the scheduler
or a thread pool
doesn't matter what, as long as it doesn't need to go through the bukkit scheduler
ok, so basicly just run async using something that isn't the bukkit scheduler
that'd be the solution?
pretty much yes
ok, thank you.
iirc completablefuture has an util method for doing just that
Why are you even using the scheduler in combination with a completable future. Completable futures can run on their own
supplyAsync or something
yea, it is executed on the common fork join pool afaik
testString.completeAsync(supplier) ?
mmmm i'll google on how to use that
thanks for pointing me in the right direction guys
i'm a pretty pointy guy
haha 🙂
final CompletableFuture<Integer> heavyComputed = CompletableFuture.supplyAsync(() -> {
return 1 + 1; // HEAVY LOGIC OFF MAIN THREAD
});
maybe that saves you a little googling
the heaviest task
you better not tell about this to the 1.8 anticheat developers
they will legitimately do 1 + 1 on a dedicated thread
lol
lol
it got worse, 1.8 isn't even the worst omg
please install the jar into your local repo
like. do you realize, do you genuinely comprehend
you cannot publish the spigot server jar anyway
oh
1.7 is when the dmca happened
August 2014 iirc
Hello there! I'm working on my first plugin. It's giving me Invalid plugin.yml although I see nothing wrong with it.
this is my yml:
name: HelloWorld
version: 1
main: sussy.live.firstplugin.Main
description: My first bukkit plugin!
commands:
hello:
aliases: [hi]
description: This is the hello command
what is the actual error
just to make sure discord doesn't do funky formatting
ah ok
do you want logs?
no, i want the full error
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
is this what you needed?
more
1 sec
ok
name: HelloWorld
version: 1
main: sussy.live.firstplugin.Main
description: My first bukkit plugin!
commands:
hello:
aliases: [hi]
description: This is the hello command
no.
Code blocks
oh ok
org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here
it is not valid yaml syntax
plug it into a yaml validator and see what the issue is
name: HelloWorld
version: 1
main: sussy.live.firstplugin.Main
description: My first bukkit plugin!
commands:
hello:
aliases: [hi]
description: This is the hello command
?
this is also not the same yaml that is in the plugin
Caused by: org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here
in 'reader', line 4, column 56:
... ukkit plugin! Used this tutorial: https://www.youtube.com/watch? ...
you need to escape special characters or wrap the string in ""
look up a yaml tutorial, use an online yaml validator to figure out whether the yaml is valid or not
This is a code block with syntax highlighting
next time around, read the error
Is there a way to check if a player moves?
Player move event iirc
rip
EntityExplodeEvent is not correctly working, if im creating the explosion in my plugin. So does anybody have any idea how should I check the destroyed blocks or smthing then?
Cuz i need to.
Basically the e.blocklist is not printing out when the explosion is created by my plugin
wut
if you are creating an explosion directly with your plugin, it obviously won't fire an entityexplodeevent, as no entity actually exploded
you're just creating an explosion
that won't get fired either
as no block actually exploded
you're just creating an explosion
So Im using PlayerMoveEvent but how can I "link" it with my command?
idk why but blockexplosionevent catched it
seems not logical that it would, but it did
depends on your definition of "link"
idk if you could say Implement
... what are you trying to do
explain yourself, nose and chin man
wow, I have a command and what I'm wanting to do is if the player moves then the command is canceled
so I have the PlayerMoveEvent
Could have like a map of players waiting for a command to finish and check that on player move and if the player is in the map cancel the command
I’m just throwing an idea off the top of my head doe
yeah, that is generally what is done
my plugins placeholder doesnt work in a gui of the same plugin
but it works in featherboard
why is that?
any other way?
part of programming is coming up with your own solutions... is there a problem with what i suggested?
then figure out a better way.. lol
it isn't particularly slow
youre particularly slow
your mom
Hopefully I'm allowed to ask this here, sorry if I'm not:
Alright, so, I'm kind of stuck on what I should do here and want some opinions. I'm working on some custom enchantments, with the two I have right now, the first lets you fly if you have it on a chestplate and the second makes blocks you break go into your inventory automatically without dropping on the ground. I want people to be able to get these in "vanilla" survival, but I don't want to use a normal book and anvil/enchantment table, I was thinking something like dropping items and their tool/armor onto a certain block(s) to get it. Any ideas on what I could do?
https://gist.github.com/polkacentral/5efa92924680b518ff44328c126dc483
I have plugin with a currency.
In the SHOP gui class part of the plugin, where you spend that currency, when i add %gems_amount% placeholder into the lore of an item in the gui in the config, it will not show up.
If I use the placeholder anywhere else outside of the plugin, the placeholder works perfectly
Do I need to register the placeholder or something in this class or something?
check for the drop item event or whatever
it doesnt show on phone tho
then after a second or two check back on the item and see where it landed
and then check whether that is "a certain block"
no but it does for everyone on desktop
I'm more of asking if anyone has any other ideas for something I could do for adding the custom enchants.
populate it as dungeon/mineshaft loot
do... do you have PlaceholderAPI as a dependency? lol
rare drops from mobs like withers/guardians/elder guardians
expensive villager trade
there's a method to replace placeholders in a string
I mean for someone adding the enchant @wraith rapids
loot context
one plugin had you "combine" two stacks of items
one being the item you wanted to enchant, the other being the enchanted book/tome/whatever
you'd then intercept this click event and apply the enchant onto the item the enchant was dropped on
What blocks keep their NBT values when placed?
papi is a depend
tile entities
i setup ```java
String translatePlaceholders(String s, GemUser gemUser, GemPick pick, EnchantmentItem item) {
String levelsAdded = "+" + item.getLevelsAdded();
int upgradePrice = item.getUpgradePrice(pick.getEnchantmentLevel(item.getEnchantmentType()));
String price = ChatColor.WHITE + MessageFormat.format("\u2666{0}", upgradePrice);
if (!gemUser.hasEnoughGems(upgradePrice)) {
price = ChatColor.RED + MessageFormat.format("\u2666{0}", upgradePrice);
}
GemEnchantment enchantment = EnchantmentRegistry.getRegistry().getEnchantment(item.getEnchantmentType());
if (pick.getEnchantmentLevel(item.getEnchantmentType()) == enchantment.getDynamicMaxLevel(pick.isBoosted())) {
price = Message.STATUS_LORE_MAXED.toString();
}
return s.replace("%levelsAdded%", levelsAdded)
.replace("%currentlevel%", String.valueOf(pick.getEnchantmentLevel(item.getEnchantmentType())))
.replace("%gembalance%", String.valueOf(gemUser.getGems()))
.replace("%price%", price);
}```
Only tile entities?
thats in inventoryconfig.java
yes, only tile entities
i want to use that placeholder in upgradeconfig.java
Well shit
other blocks are not able to store anything
do i need to mention something about those placeholders in upgradeconfig.java?
String.valueOf and not "" + whatever
Maybe a beacon for the ones that should be rarer...
i don't remember if a beacon is a tile entity
Do beacons keep their data?
i think it might be
I'll only really be checking for a custom name, so if that's still there after I place and break it then it should work
Name doesn't save
use the pdc
if it's tile entity, it has a persistent data container
store your "this is special" information there
Hey when i leave as passenger the vehicle i will get kicked with the messages "Disconnected" and no error in console
bruh why is savagefactions so shit
like i said
use the pdc
store your "this is special" there
you don't need a custom name
the reason why those are tile entities is mostly cuz they need to store nbt
idk about the campfire
XD
lectern needs to store the book data i think
What does that mean?
campfire needs to store the shit you cook on it
lol
Oh
tile entities are persistent data holders
they hold a persistent data container
which can persistently hold arbitrary data
I'm kind of thinking a custom name so that I can make a resourcepack to go with it
its probs possible to make a plugin that adds nbt to basically every block
but idk how u would do it
not really, not through bukkit anyway
maybe for spigot or paperspigot
spigot and paper are bukkit
attempts have been made but they are relatively crude, inefficient, and ineffective
and paper hasn't been called fucking paperspigot for like 5 years
paper, spigot, tuinity and purpur and all of that downstream shit are all implementations of the Bukkit API
Anyway, I was thinking a custom name so that I could make a custom model for it with OF or something
then your options are limited pretty much solely to containers
I like the idea of a brewingstand
i call it paperspigot lol
Typing go brr
and I call you stupid
lmao
i dont know why
i just type spigot at the end
it is a fork of spigot tho...
i think it should be called paperspigot
yes, and tuinity should be called tuinitypaperspigot
and spigot should be called spigotcraftbukkit
i seen a skript addon that did it i think
do you realize how dumb that is
yes but i meant just paper should be called paperspigot
paperspigot has more of a ring to it
yeah
also i think i heard to much people calling it paperspigot
that i decided to call it paperspigot now
that's just because you run in stupid 1.8'er circles
lol
XD
what percentage of servers use 1.8 again?
like 2%
8
i thought it was 2%
it's like 2 on paper probably
i thought it would be way more...
it's not as popular as people think it is
i either use 1.12.2 or 1.16.5
so I have ```java
Map<String, Integer> killstreak = new HashMap<String, Integer>();
getKey?
that's not how maps works
the gig of a map is that you give it the string to get the integer
idk how u use maps
not the other way around
ok
map.get(player.getUniqueId())
i thought it was getKey
you thought wrong
u know what idk anything about maps i never used them
XD
because i havent really made any plugins yet
that's because you haven't put anything in yet
if a given key does not have an associated value, null is returned
I did killstreak.put(name, kills);
did you make it use UUIDs
yea
then don't put name
u need to put the uuid not the name
put the uuid
doesn't change anything though
if it returns null, that key does not have a value
which means you're not calling put with the same key before
oh yea forgot to tell you my map is static hehehhe
that shouldn't matter
public static Map<UUID, Integer> killstreak = new HashMap<UUID, Integer>();
@EventHandler
public void PlayerDeath(PlayerDeathEvent e) {
Player player = e.getEntity();
if (player.getKiller() instanceof Player) {
Player killer = player.getKiller();
addtokillstreak(killer);
killstreak.put(player.getUniqueId(), 0);
}
}
public void addTokillstreak(Player killer) {
UUID uuid = killer.getUniqueId();
if (killstreak.containsKey(uuid)) {
int kills = killstreak.get(uuid);
kills++;
killstreak.put(uuid, kills);
} else {
killstreak.put(uuid, 1);
}
}
you are always putting 0
Alright, what the I mess up here? When I reload it throws an error (https://paste.ubuntu.com/p/KJdbncMzDP/).
https://paste.ubuntu.com/p/YDQdWJJtVw/
are you reloading the plugin
Using /reload from MC
restart
make sure in ondisable u unregister the nchantment maybe
hm
wym?
killstreak.put(player.getUniqueId(), 0);
you are always overriding the value with 0
Uh
How would I do that?
Also, that shouldn't break items that have the enchant, right @granite stirrup?
public static Map<UUID, Integer> killstreak = new HashMap<UUID, Integer>();
@EventHandler
public void PlayerDeath(PlayerDeathEvent e) {
Player player = e.getEntity();
if (player.getKiller() instanceof Player) {
Player killer = player.getKiller();
addtokillstreak(killer);
int killstreak = killstreak.get(player.getUniqueId());
// do extra stuff with killstreak
}
}
public void addTokillstreak(Player killer) {
UUID uuid = killer.getUniqueId();
if (killstreak.containsKey(uuid)) {
int kills = killstreak.get(uuid);
kills++;
killstreak.put(uuid, kills);
} else {
killstreak.put(uuid, 1);
}
}```?
oh
ummmm i dont think so? it might not sure
it doesn't
How do you unregister an enchantment, anyway?
through a very annoying and difficult procedure that involves nms and reflection
idk
just restart your server
This
Oh...
null still
whats null?
kill streak
probably not
public static Map<UUID, Integer> killstreak = new HashMap<UUID, Integer>();
@EventHandler
public void PlayerDeath(PlayerDeathEvent e) {
Player player = e.getEntity();
if (player.getKiller() instanceof Player) {
Player killer = player.getKiller();
addtokillstreak(killer);
int killstreak = (int)killstreak.get(player.getUniqueId());
// do extra stuff with killstreak
}
}
public void addTokillstreak(Player killer) {
UUID uuid = killer.getUniqueId();
if (killstreak.containsKey(uuid)) {
int kills = (int)killstreak.get(uuid);
kills++;
killstreak.put(uuid, kills);
} else {
killstreak.put(uuid, 1);
}
}```
null
and send the actual class over pastebin
try that?
null is not a fucking exception
what prints null?
there's nothing that'd print anything in this entire block of code
KillStreaks.killstreak.get(p.getUniqueId())
that does not print anything
that doesnt print anything lol
....
you are testing my patience nose and chin man
you joking
System.out.println(KillStreaks.killstreak.get(p.getUniqueId()))
would print something
get alone does not print anything
you casting it to int blindly may throw a null pointer exception
but it does not print anything by itself
Would ARMOR_TORSO also include an elytra?
Afaik yes
I mean - it’s on the torso slot
but it's not armor
I thought it was considered so
technically it is
in some bastardized fashion yes it could be considered armor
that is correct it prints null
....
then where the fuck are you reading the null
nose and chin man
you are not making any sense
From the sys out he means
there is no sysout in his code
that's what I wrote
i did write a sysout example
Yeah and he copied it
but we haven't seen code with a sysout in it
wait wherever u wrote it did it have a player variable
god imgur is fucking laggy
I didn't think it would needed to show it
Can you just verify please
I
show code where it is
Okay so, you need 5 stacks of 32 diamonds placed like a plus in the crafting table. And when you pick the result it takes away all 32 diamonds from all 5 stacks. like in hypixel skyblock. how can i do that in 1.16.5?
So you can send images
!verify
Usage: !verify <forums username>
you would need to listen to prepare craft event or something
recipes themselves don't support stacks
I don't remember my spigot account
send updated code
make a new one then
me?
.
send updated code
oh shout i am on my alt
@EventHandler
public void PlayerDeath(PlayerDeathEvent e) {
Player player = e.getEntity();
if (player.getKiller() instanceof Player) {
Player killer = player.getKiller();
addToKillstreak(killer);
}
}
public void addToKillstreak(Player killer) {
UUID uuid = killer.getUniqueId();
if (killstreak.containsKey(uuid)) {
int kills = killstreak.get(uuid);
kills++;
killstreak.put(uuid, kills);
} else {
killstreak.put(uuid, 1);
}
}
it prints in a different class
public void run() {
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
Player killer = p.getKiller();
ScoreboardHelper board = this.scoreboardHandler.getScoreboard(p);
board.clear();
board.add(lines);
board.add(separator + "&c");
board.add("Killstreak &a"));
board.update(p);
System.out.println(KillStreaks.killstreak.get(p.getUniqueId());
}
}
have you killed another player
yes
since last loading the plugin in
verify that your event handler works
no
then that is why
woopsy
yeah if u want to fix that ur gonna need to store kills somewhere
.
anyone at my case?
i already answered you
np lol
you said by updating to 1.16.5? so i did?
I already have the kills
i answered you a second time
no i meant if u want keep it after reload
?paste
i was afk, didnt see. can u copy paste?
.
Oh
lmao
Should I just store it in a json?
statistics
no, you should store it in the player's persistent data container
These are the events I have for enabling flight with the enchant, I can still fly after I take the chestplate that has the enchant off, any ideas about what's wrong?
https://paste.md-5.net/jafogacadi.cs
there. are. statistics.
yes, but they don't track streaks
where is that located?
click events are fired before the actual action has been performed
so during the click event, the item is still equipped
and thus your code doesn't fire
Oh
wait where do player data in that actually get stored in a file?
crap
in the playerdata
Any idea how I could fix that?
check whether the player is clicking on the armor slot
isnt file stuff like slow as shit?
yes, but that doesn't do file stuff
Wouldn't that have the same outcome?
well it does when it saves the world right?
you'd have to use the event to figure out whether the item was removed and had the flight enchant
instead of the inventory
yes, the server does file shit when saving the world and playerdata
you know im on 1.8.8 right
async on paper, probably sync on spigot because splögget sux
nose and chin man has condemned himself
use json or whatever i guess
The same event I'm using right now?
then use json but its probs gonna be slower than persistentdataholder
So...
may I ask why 0 is null?
it's not
if it is the chest armor slot, check what is in the slot
if the slot contains your special item, remove fly
however, keep in mind that there are several ways for players to equip and unequip armor
it isnt its just showing null cuz u never set it
and the only way to actually keep track of what players are wearing is to check every tick
or use paper, which has an armor change event
or use the lib
I have the interact event for when the player right clicks the chestplate to put it on, what other ways are there for unequiping it?
