#help-development
1 messages · Page 1526 of 1
i have this error : Caused by: java.lang.NullPointerException
code
Thing is i still want to check if where a point is is air. Even if its a block.
This is the only method that does what I'm searching for - collision. Doesn't seems to exist for points.
In other words by using this it should work.
public boolean isAir(Location l){
return World.rayTraceBlocks(l, new Vector(0,0,0), 1/64) == null;
}
luckily that also means by taking the edges of the player hitbox and shifting them i can do collision detection
if(item.getItemMeta().getLore().get(0).equals("My very cool lore.")){
fails if there is no lore
then you have a pointer pointing to nothing
you need to check if that lore has any length before getting lore
is lore set on ur item and is item set?
can u show full code
?paste
is that full error btw
ok, so i verify if lore are null
I'd do it like this but no guarantee
Lore l = item.getItemMeta().getLore();
boolean haslore = false;
if(l.length()!=0){
haslore = l.get(0).equals("My very cool lore.");
}```
it returns a list of string
not a lore object
and pretty sure its size() or size, length is for arrays
If i had to guess its because youre using the name of a class for a variable name but im not too sure how your ide works
its either List<String> or Collection<String> i think
so like this?
oh
i am getting an NPE
[21:33:00 WARN]: java.lang.NullPointerException [21:33:00 WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:493) [21:33:00 WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486)
When i try to fire a custom event
thanks ill read that
Hi, does anyone know how can I open a GitHub organization repository in IntelliJ? I'm part of the organization, but IntelliJ only shows my own repositories.
Did you just try using the link directly instead of going from the list IntelliJ gives?
is it too hard to go to github.com and create repo from there xd
I tried, but IntelliJ says the repository doesn't exist (although I probably did it wrong)
That's what I did, but how do I open it inside IntelliJ?
Can you send the link you're trying to use?
I copied the HTTPS link from the quick setup
You would've gotten an access denied if it was a permissions problem, so I'm assuming because it was a not found error that the link was wrong
Is this where you're putting the link?
Yeah
And it ends in .git right?
yes
What if you try to use a link from a random public repo? Does it work then?
I tried doing this again, and IntelliJ opened a page asking me to log into my GitHub account
Login then
but then
it said Error 403: Not Authorized
This request is only valid within same origin
?
auth over ssh instead then
It does work from a public repository
because no auth is needed
you're not authenticated
if you're struggling over https because of the built in prompt, either do it from the command line (with an access token if you have 2fa) or use ssh
I used SSH, now it says permission denied
You need a key
did you give github your key?
ok thanks, i'll try that
Hello there!
I need help with creative inventory. I want to reserve some items in the hotbar (the 5 firs items) so that the player can't move it. Here is my code:
@EventHandler
public void onCreativeInventoryClick(InventoryCreativeEvent event) {
System.out.println("a");
ItemStack item = event.getCurrentItem();
if (item != null
&& item.getItemMeta() != null
&& event.getSlot() < 5
&& inspectMode.map.containsKey(event.getWhoClicked().getUniqueId())) {
event.setCancelled(true);
System.out.println(event.getCurrentItem());
System.out.println(event.getCursor());
System.out.println("b");
}
}
The problem is that when I take an item, it is not removed from the hotbar but duplicated
add one line that removes items held in cursor?
Are you sure you want InventoryCreativeEvent and not InventoryClickEvent?
Well I guess InventoryCreativeEvent is a subclass
It's been a while since I've done inventory stuff but IIRC cancelling InventoryClickEvent removes the item from the cursor
My sysout print AIR in cursor
You sure it isn't just a visual client bug?
Yes, I have the same issue with InventoryClickEvent
I don't really care because the server doesn't check anything on a creative player
so the player keeps the duplicated item
I could set the item held in cursor to air in the next tick but it's pretty ugly
What happens if you try to drop the duplicated item, for example? If it's a visual bug the item should just disappear
ItemStack[] getContents();
@NotNull
ItemStack[] getStorageContents();
in org.bukkit.inventory.Inventory
I don't understand the difference between those (I read jd)
I'll try it
Yes I can
It's just what the JavaDocs says, getStorageContents() will ignore slots where items cannot be "stored", so think stuff like the right side of a furnace
Ah thanks, now I understand
You can drop the item in your cursor even though the server thinks it's air?
I don't think the server thinks it's air
?
I think this is just not the same tick
when the event occurs it is AIR : the item is not at two different places at the same time
but on the next tick it moves to the cursor
Drop a runTaskLater in there and check?
but because I cancelled the event, it is not removed from the inventory
check if this is not AIR?
Why do you want to check that?
Just check what the server thinks it is
It's not normal for the item to move to the cursor if you cancel the event
What spigot version are you using?
I'm pretty sure that when the cursor will change my event.getCursor() will still link to the previous item from the event object
1.17
What is containsAtLeast(ItemStack item, int amount) in org.bukkit.inventory.Inventory ?
It checks if your inventory contains at least amount * item?
declaration: package: org.bukkit.inventory, interface: Inventory
But I already saw the method contains(ItemStack item, int amount), isn't this the same?
is the chunk unloaded when none of the players are loading it?
wtf dude
how often do you want it to run, cause right now it looks like 15 minutes
oh lol sorry i want it to run every minute
you run it now every 60*15 minutes
15 hours
oh lmao
bad math guys
20 ticks = 1 minute
For 1 minute
Lol
so that will do it every minute?
Yus
thanks
math
No it's not
math
ah
:U
i bad
math math math
sry
go bad to math
math
Don't post help dev answers if you don't know
fucking math
recently woke up, sorry
I forgive you
who can just setup geyser for me
?
No
?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/
there's no setup required
go to geysermc discord.
I just throw the plugin in and I'm done
where is the getMin/MaxBuildHeight in nms? i can't find the methods at all
why nms
ooo why not nms
cast to bukkit world
they cant do crap bc they really dont want to help me Is ThEiR A eRrOr like damn i just made the server yesterday and im trying to join from bedrock i mean how the frick am i supposed to set it up
do not damn link me to the fricken github
It's not in the api cause Mc doesn't even support it yet
I've just been generating new level.dats
IIRC yes unless it's spawn chunks or they're remotely loaded through various means like nether portals, glitched arrows, etc.
how do datapacks do it then :]
by making a level.dat
Data packs aren't base Mc
That's why it's in a separate data pack....
I've been trying to research datapacks and all the spigot configuration for world gen this week
u needn't
wait a second
{
"logical_height": 384,
"infiniburn": "minecraft:infiniburn_overworld",
"effects": "minecraft:overworld",
"ambient_light": 0.0,
"respawn_anchor_works": false,
"has_raids": true,
"min_y": 0,
"height": 384,
"natural": true,
"coordinate_scale": 1.0,
"piglin_safe": false,
"bed_works": true,
"has_skylight": true,
"has_ceiling": false,
"ultrawarm": false
}
put it into DATAPACK/data/minecraft/dimension_type how overworld.json
in datapack you can change height
the second line - logical_height
it does not interfere with other plugins, because generation is not specified
only the TYPE of the world is set.
That almost looks the same as the caves and cliffs dimension_type for overworld
that is
but min_y is upped
to 0.0
yes
without negative y, because the most of plugins don't support this.
i free use this with TerraformGenerator
guys... i have this code that runs when a player click's the specific item (in this case slot 10), and i want then to update the item's lore. The problem is, the item name doesn't update. it always stays at false. the boolean that is responsive for it changes how it should (same as the config-entry), but the item-name stays the same. even after re-opening the inventory, or even reloading.
private void handleClick(Player p, int slot) {
if (slot == 10) {
Challenges.getPlugin().getLanguageManager().getConfig().set("challenges.blockbreak.enabled", !blockbreak);
blockbreak = !blockbreak;
} else if (slot == 18) {
initMenu(p, SETTINGS_MAIN);
return;
}
initMenu(p, SETTINGS_CHALLENGES);
System.out.println("Inventory updated: " + blockbreak);
}```
`initMenu();` is:
```java
public void initMenu(Player player, Inventory inv) {
buildItem(SETTINGS_MAIN, Material.RED_BED, 1, 1, LanguageManager.getTranslatedString("title_challenges"), LanguageManager.getTranslatedString("description_challenges"));
buildItem(SETTINGS_MAIN, Material.LIME_DYE, 1, 8, LanguageManager.getTranslatedString("title_language"), LanguageManager.getTranslatedString("description_language"));
buildItem(SETTINGS_CHALLENGES, Material.DIAMOND_PICKAXE, 1, 10, LanguageManager.getTranslatedString("title_blockbreak"), LanguageManager.getTranslatedString("description_blockbreak"), "", getEnabled(Challenges.getPlugin().getChallengeSettings().blockbreak));
buildItem(SETTINGS_CHALLENGES, Material.RED_WOOL, 1, 18, LanguageManager.getTranslatedString("title_back"));
buildItem(SETTINGS_CHALLENGES, Material.LIME_WOOL, 1, 26, LanguageManager.getTranslatedString("title_forward"));
player.openInventory(inv);
}```
i simply put it in bukkit/data/minecraft/dimension_type.
ah shit, for large codes use:
?paste
i dont really see this as 'large', but sure
item.setMeta(meta);?
should show buildItem
private void buildItem(Inventory inv, Material mat, int amount, int slot, String displayName, String... lore) {
ItemStack stack = new ItemStack(mat);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(displayName);
meta.setLore(Arrays.asList(lore));
stack.setAmount(amount);
stack.setItemMeta(meta);
inv.setItem(slot, stack);
}```
i mean, it works at the beginning
but it doesnt really update
basically when it's slot 18, i want to go to the inventory the player was before. but on slot 10, it just should update the actual inventory.
so basically this one
so getEnabled(Challenges.getPlugin().getChallengeSettings().blockbreak) is always returning false?
no
in sysout, it returns true/false, whatever is in config, or whatever the boolean is
so it's just the update of the item i guess
this getEnabled is btw just a converter from true/false to on/off with colorcodes
I'm trying to prevent a player from putting an item in a chest -- am I correct in my reading of the docs that I'll need to cancel both the InventoryClickEvent and the InventoryDragEvent separately? Or is there a better way to do it?
yeah, it doesn't look like I can search for the specific item
might be somewhere in Event.Result
I want to optimize my build process to automatically restart the server
does anyoneknow how to perfom an proxy command on spigot
Hii, my listener is not working.... can Someone help?
post code and tell us how its "not working"
?paste
ok
halp! no detail! only halp!
yee sorry xD
Hi, I would like to ask how can I do that by right-clicking on an item in the GUI. It happens that there must be a certain block, for example OAK_LOG, and when you destroy it, it will write you a message, but if you click the right button on the mouse, it is true, and when you click the left button, it will be false. And sorry for the English.
why
are
you
using
that
many
spaces
consider learning english
Is there a way to get the minecraft name of an enchantment? who the fuck is going to know what water worker is? https://i.imgur.com/C4cfnCf.png
Can anyone help?
no helping allowed
Loop?
tf you mean loop?
Idk if u could use something like a TranslatableComponent for that
Hi, I have a problem with that code
equals reference comes up as invalid
with the error Cannot resolve method 'equals(java.lang.String)'
looks oddly unusual
can anyone help me with this error, the boolean "rare" always goes back to it's starter form. https://pastebin.com/zs2BKNM1
wym starter form?
as you can see it says "public boolean rare = false;" I am setting it to true but it just goes back to false
change boolean to static?
oof don't listen to me
I don't even know what that code wants from me 😂
However DevLab
if(rare){
if(e.getMessage().contains(Anime.List.Garou.getName())){
player.sendMessage("RIGHT!!!!");
rare = false;
this would make it go back to false when its true and you send a chat?
yea, it will first send that this was right, and then i want to start again, but i don't get that message
I get "false" and "mhaa"
peper has getLocale methods
TranslatableComponent might do the job as well as Conclure said
DevLab basically the initial assignment to rare is false, and then whenever that event triggers it is still false so I don't really know what's the issue here.
im looking at TranslatableComponent, so far looks like it would work
edit: it did, thank you!
Unless you're actually calling that rare() method of yours albeit you should probably use the BukkitScheduler and not TimerTask & Timer (quite outdated class)
bruh
I've never seen TranslatableComponent before looks very cool.
yeah same, actually really helpful
I am calling the rare() timer first in onEnable,
scheduleTimers.rare(); //True
enableCommands();
enableListeners(); //Check - True?
Just why does deserializing an ItemStack include everything apart from the itemMeta? 🤦♂️ 🤦♂️ 🤦♂️ 🤦♂️ 🤦♂️ 🤦♂️ !!
What do you mean?
You can ItemStack.Serialize(), which will serialize an entire item perfectly, just as requested
but then .deserialize() shows up and deserialzies everything but the itemMeta..
and there's no ItemMeta.deserialize() function, so I'm royally shafted 🙂
need to work out how the hell imma turn this Map<String,Object> object, which contains the ItemMeta as a key, into an ItemMeta...
well u could look at the itemmeta class
CraftItemMeta.deserialize probably
ooo
There's no such thing as CraftItemMeta?
use ConfigurationSerialization.deserializeObject(map,ItemMeta.class) also
it should work equivalently
fml
Thank you to the person who went out of their way to ensure deserializing an ItemStack removes the meta key
Hey guys ! I'm trying to use Worlguard API in my plugin, does anyone knows how could I get the size of a protected region ?
Like I want to do something whenever a region reach a particular size
bruh. why does InventoryDragEvent not have an equivalent to getClickedInventory()? do I have to look at the raw data myself to determine whether the player is dragging into the top or bottom inventory?
Well there's no click involved in InventoryDragEvent
yeah think so
Hello everyone, I am in the process of making an item menu plugin and am currently having problems with getting the plugin to cancel PlayerDropItemEvent and for it to remove the items when it is dropped on death. I am currently using persistent data to track the item and I can tell the item is getting the data since its running the command I defined which i have coded to only happen if the item has that persistent data. Does anyone have any ideas on how I can fix this? Alternatively if you know a good item menu plugin that I can use instead of making one that would be appreciated.
Couldn't you use PlayerDeathEvent to remove the items on death
Thats what I am using to detect a player death
or no I misread?
Also what problems are you having specifically.
correct
what is code for canceling drop event?
So in terms of the item drop problem the plugin doesnt seem to be canceling the drop event and is freely allowing players to drop the item when its in their hand
For the death problem the item is not being removed when the player dies and items are dropped
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockInteractions2(PlayerDropItemEvent event){
Player p = (Player) event.getPlayer();
ItemStack item = (ItemStack) event.getItemDrop().getItemStack();
ItemMeta meta = item.getItemMeta();
PersistentDataContainer data = meta.getPersistentDataContainer();
if (data.has(new NamespacedKey(ItemMenu.getPlugin(), "itemmenu"), PersistentDataType.STRING)){
event.setCancelled(true);
}
}```
ignorecanceled true?
and heres the one for the death event
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockDropdead(PlayerDeathEvent event){
Iterator<ItemStack> iterator = event.getDrops().iterator();
while (iterator.hasNext()) {
ItemStack next1 = iterator.next();
ItemMeta meta1 = next1.getItemMeta();
PersistentDataContainer data1 = meta1.getPersistentDataContainer();
if (data1.has(new NamespacedKey(ItemMenu.getPlugin(), "itemmenu"), PersistentDataType.STRING)){
iterator.remove();
}
}
}```
remove ignoreCancelled = true
PlayerDeathEvent isnt cancellable btw
Would be dope tho
wait it isnt
i swear i have before
Nop it's not
ok wait so for the player drop event I remove the ignorecancelled thing
u dont need it for both
what exactly does that do then?
ignorecanceled?
yea
setting ignore cancelled to true will ensure that your event handler method wont fire if the event is cancelled
or that
its ignoring cancelled events basically
Ok I would have thought that would be a good thing to have but you guys are the experts here
and that should fix the playerdropitemevent, right
but yeah as Chew said, for the death event just remove the items straight from the inventory
hmm unsure adwm but try and see, I mean if you're cancelling it, then yeah
yes
No Idea how to remove it from the inventory
worst case would be where you have to call PlayerDropItemEvent#getItem#remove and readd the item instead of cancelling it
im assuming I can just do like event.getPlayer().getInventory().setItem(8, air)
C:
ok thanks
any tips to calculate number of blocks in a radius of x blocks ?
math
yea but not sure how to calculate blocks shaped sphere u know
hmmm
So with the PlayerDeathEvent I cant do event.getPlayer().getInventory().setItem(8, air) since getPlayer is not a method in the event, what should I use instead
Well you need to have the BT jar in the same folder as where you started that prompt in
Or navigate to that folder with cd path
how do I know what folder I started the prompt in
ok this should be the last thing for the death event, but what should I put for air? it wants an itemstack but air isnt an itemstack
new ItemStack(Material.AIR)
whats cd path
cd is like goto folder structure
where do I find the command path
path is the directory path
Why does Craftbukkit not have a repo man >_>
The path will look something like this C:/blah/directory/
and why does spigot not contain it's own implementation of CraftMetaItem.... this is such a mess
ok
Popzi cuz it’s api vs implementation
so like my local server folder?
Also you don’t need the cb dependency, we have spigot after all
?Bt ohagain check this
and yeah that's where you put BuildTools
?bt
ive been to that website
then whats the import path for the function to make a new ItemMeta type? for spigot xd
its a good website
Watever folder containing you bt jar
Wym?
You said I don't need the craftbukkit dependency
oh fuck
Yeah Popzi
why did it just generate
we have spigot instead
spigot for artifact-id instead of spigot-api
So where's the spigot equivelent of org.bukkit.craftbukkit.Inventory.CraftMetaItem ?
When I am developing plugins I only use the spigot server jar
i just answered you
as a dependency
ok so first where do I put my files
Wherever you want
uhhh
Then proceed to the directory you put your bt file and run the command
I don't see any spigot folders generated after running buildtools btw
https://hub.spigotmc.org/nexus/content/groups/public/org/spigotmc/ there's no up to date 'spigot' release... only the spigot-api??
huh i double clicked the build tools file and it generated the files
You need to run buildtools and install the spigot dependency on your maven local repository due to DMCA
like you were showing us
Or smtng like that
to add to my point, this is a mess
can you give an example
I'll show you mine
k
I just need to get something striaght with this code ```java
public class JoinListener implements Listener {
private Main plugin;
public JoinListener(Main plugin) {
this.plugin = plugin;
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
SkinGrabber.changeSkin(e.getPlayer());
}}, 0L, 1200L);
}
}``` so basically when I join the server the scheduler will start and every minute it will do the thing I put in SkinGrabber.changeSkin right?
Try using BukkitRunnable instead
so I just type the code into git bash?
ok
it is the same thing as regular sched right?
java -jar BuildTools.jar --rev 1.17 would work if you run it in git bash and git bash's working directory is the same as that of where you installed buildtools
it should be, not so sure if it really matters
oh wait
it says that bukkit runnable is deprecated
you are still not in the right directory I think
okay I will help you some more by telling you what to do
ok
does cd Downloads work?
idk then, BukkitRunnable isn't deprecated the last i checked
yeah but if you type cd Downloads in gitbash will that bring your console's working folder to Downloads?
or does it error?
ohh
the alternative is something likecd C:/...
why for the love of god is spigot-api available through the repo, but spigot isn't? 🤦♂️
okay run the buildtools cmd
ok
told you, DMCA, spigot contains minecraft code
its doing stuff
like this right? ```java
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new BukkitRunnable() {}, 0L, 1200L);
now next time someone asks you this question ohagain, point them to that page you said you read already
ok ill do it
there is a run method that you would need to implement, but yea that one
i went back to java 16 after it saids only up to java 15 is allowed i think
in run.bat
I don't see how distributing it via a crappy Buildtools jar is all that different from just slapping it on a repo
yeah it says deprecated
ill download 16
but its 1.17
What
it requires java 16
because buildtools download server from minecraft website, not redistributing anything
should i uninstall java 15
nope, dun have to
ok
in fact you should keep it
No need to uninstall
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment 21.3 (build 16.0.1+9)
OpenJDK 64-Bit Server VM 21.3 (build 16.0.1+9, mixed mode, sharing)
[root@router BuildTools]# ```
you can have both
I uninstalled 15
dun uninstall so you can run things that require <= java 15
yes
its running
Only Microsoft would make something as highly modifiable as Minecraft not redistributable... such backwards design
Glad I could offer assistance, did you read this yet? https://www.spigotmc.org/wiki/buildtools/
because it basically gave all the instructions I just did >:U
if you ever run into this situation, then you should exec the java executable of the lower version
instead of downgrading java
I mean it’s probably fine uninstalling j15 but I would advice to have j11 and j8 still
i did
I got this error... can someone help?
I'm using Javacord btw
Code:
System.out.println("Received message!");
Optional<TextChannel> channel = api.getTextChannelById(825085528398888970L);
channel.ifPresent(textChannel -> textChannel.sendMessage("Hi"));
}```
Error:
```Could not pass event AsyncPlayerChatEvent to project```
Anyone know why I get a NoSuchFieldException here? ```java
try {
Field f = item.getClass().getDeclaredField("meta");
f.setAccessible(true);
ItemMeta meta = (ItemMeta) f.get(null);
if(meta == null) {
f.set(null, Bukkit.getItemFactory().getItemMeta(item.getType()));
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}``` (item is a ItemStack)
ok so I built my plugin and put it on my server and I am getting an error saying that it was compiled by a more recent version of the java runtime, how can I build it in a lower version?
Are you using IntellliJ
yes
1.17?
Which version do u buiild ur project @full pelican
No. 1.16.5
55.0 or lower
Minecraft version ?
f.set(null,...) ?
And which version is your server?
1.15.2
hm...
oh wait shit
How would you get a field if it's not static? @ivory sleet
we just changed your java version
I can't help u further sorry adwm
f.get(instance)
Hello I have a question, for people who are developers, etc ... I am using Intellij idea to create plugins right now and I would like to know if in visual studio code you can also create plugins or not but with maven if
damn ok, ill keep looking around and see if I cant find a way to do it
Yeah
Thanks bro

Yes you can
Try copying the error into google
will do
this is an ez fix adwm
What do I need to do chew
?
how do I do that
Well I can show you how I do it in Eclipse is that fine?
Yea thats fine
here is an example of an outdated plugin that has depenencys that would not work on a new server https://gyazo.com/b53a2dcbee6c9992b6e0677eccbdfa86
I would remove the old jar references, and add a new one
ok I see now, thank you
np
@ivory sleet Hmm, I still get the same exception
Yea also the class might not have the field
Idk but check if CraftItemStack has a field called meta then?
Alright
Else if you wanna be sure to get the right field from the right class use ItemStack.class.getDeclaredField(...)
Ight
@ivory sleet The reason I'm doing this is becuase I cannot enchant my item with my custom enchantment
It does not get added to the enchant list
Sounds odd to use reflection for that then lol
item.getEnchants() returned an ImmutableMap, and that was because the ItemMeta was null
So I tried to recreate it or smth
Use ItemMeta?
It won’t be once getItemMeta is called
Alr
Or I mean setItemMeta I think
But yeah just get meta -> apply enchants -< set meta back
Mhm
ok so anyone who using intelliJ got a question for you. I am trying to build my plugin after switch my java version to java 11. I switched everything out in the libraries but somewhere its defined as java 14 and I have no idea where to it is to fix this. Does anyone know where to find and fix this
Heyy uhh does anyone know why block coordinates are offset by -1 on x? (when x is smaller than 0)
currently I am standing at -20 76 64. The Block coordinates are -21 76 64
fixed it
ok so I finally got the plugin loaded and whenever I die the item still drops on the ground
@ivory sleet So, I added the enchants, but ((Player) e.getDamager()).getItemInHand().getEnchantments().containsKey(Enchantment.getByKey(getKey())) still returns false
switched back to my old code working nicely
bye bye java 16
I'll show you an up to date plugin dependency list even though I don't use intelliJ
block coordinates are rounded towards negative infinity
the center of a block is at 0.5
the block coordinate is the location of the bottom east north corner of the block
that is, a block at xyz 000 spans from xyz 000 to xyz 111
the apparent difference between -20 76 64 and -21 76 64 is that you are actually standing at -20.23 76.0 64.33
the visual numbers are rounded evenly to 20 76 64
but the block coordinate is rounded towards negative infinity to 21 76 64
No I am standing at the exact coordinates.
Other example:
I am standing at exactly -16 97 20
Block coordinates are -17 97 20
and...
I am standing at exactly 16 97 20
Block coordinates are 16 97 20
what happens if you move to exactly -15.999 97 20
This messes a little with my plugin and I dont know how to fix it
Block Coordinates move to -16
this is caused by the fact that the lower bound is inclusive
but the upper bound is exclusive
-16 can only point at one block
spigot api dependency suddenly broken today for anyone else?
Nvm
hangar not out
you don't need hangar to depend on paper
and hangar will probably never be out
kind of best to depend on spigot api
they'll keep working on it until minecraft dies
How do I fix the negative coordinates thingy?
I want my plugin to place a block at the location of a player. When the player is in a positive range everything works like it should but when he is at negative the block placed is always one block off.
it works fine unless you are doing something weird
this only happens when a player is standing exactly on the border between two blocks
No
which is practically impossible without hacks or commands
then you are fucking something up somewhere
show code
Location tmp = new Location(loc.getWorld(),loc.getX(),loc.getY()+1,loc.getZ());
if(loc.getX()<=0){
loc.setX(loc.getX()+1);
}else if(loc.getZ()<=0){
loc.setZ(loc.getZ()+1);
}
for(int j = 0;j<2;j++){
for(int i = -1;i<2;i++){
switch (direction) {
case "NORTH":
tmp.setX(loc.getX()+i);
break;
case "SOUTH":
tmp.setX(loc.getX()-i);
break;
case "EAST":
tmp.setZ(loc.getZ()+i);
break;
case "WEST":
tmp.setZ(loc.getZ()-i);
break;
}
loc.getWorld().getBlockAt(tmp).setType(Material.IRON_BLOCK);
System.out.println(tmp.toString());
}
tmp.setY(tmp.getY()+1);
}
loc is a location with integers so no rounding
Guess I'll just wait for it to fix itself tomororw.
Did you declare the maven local repo
I have a question about YAML files:
When I use "FileConfiguration" to read YAML files, the keys seem to be case sensitive. This causes a problem where the plugin can't find certain configurations that a server admin has manually added. I did build a command which sets up the keys correctly, but not every admin uses them and thus it happens that an admin doesn't pay attention to the fact that the keys (parts of them) have to be lowercase.
Example:
"Setttings.Morelaid.Demo" does not seem to be the same as "Settintgs.morelaid.Demo". In this case exactly the part "Morelaid" or "morelaid" is the part the admins should specify in lowercase.
Is there a function which looks at the same key in both cases?
Currently I use "FileConfiguration.getString("Settings.<Username>.Demo")"
well
you could iterate through the section and check equalsIgnoreCase on each of the keys
and build a key -> actual key map and query the config through that
Okay, that's what I feared, that it only goes like this. Too bad, but then I will have to implement this.
Thanks for the help 🙂
I'm trying to modify a merchants trade result using an InventoryClickEvent listener and checking if its a merchant, basically the problem is it fires in the opposite way I want it to.
my goal is to change the result only if its an enchanted book to another item with the same enchants.
for example: I put in the items that result in a book which says the result is null, if I remove one of the items from the trade, it says its an enchanted book. I couldn't find any other events that I should use either for this.
Code: https://paste.md-5.net/xemiwumuge.java
Example of the problem: https://i.imgur.com/xWOa8ZH.gif
but.. why..
Is there an event I can use for every single time a block takes damage?
just do the trade list urself
and set it to the villager
or take the current one,loop through it,change what you need,set it back
BlockDamageEvent is when the block starts being mined, not each time the block damage state changes
just do the trade list urself
I'd rather not do this
or take the current one,loop through it,change what you need,set it back
this however, I could do. didnt think of that
it seems like it's calling the click event before it actually finishes moving the items
so you can do the check maybe a tick later?
Hmm, guess so.
I am pretty new to Plugin development (and java development) and I wanted to get some Custom Skulls in a UI. The issue is for some reason I cannot import GameProfile, which is under com.mojang, and for some reason I get an error when importing it.
I was told I needed to add a mojang repository to my pom.xml, which I did do, however it still doesnt work
specifically this import
import com.mojang.authlib.GameProfile;
did you add the dependency also?
it's not part of the spigot api
that is part of the mojang authlib
you will have to import it into your project separately from spigot
no do I have to do both?
the repository just tells maven where to look for it
k
yes, you have to do both
do you have an example dependency, don't know how to fill in all the different fields
you should be currently depending on spigot-api already, you can look at that for an example
yeah I have this one
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
but what would I change around here for mojang
group id is com.mojang
artifact id is authlib
idk what the latest version is
thank you
2.3.31 for authlib
so the spigot api dependency part doesnt have a group id, would I add that for the mojang one
All it is for me is
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
yes
literally read the first line
oh
I am dumb
it didnt indent
lmao
now my intellij is being super slow :wah:
wish I could put images in here
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>2.3.31</version>
<scope>provided</scope>
this is probably wrong? its not working
define "not working"
verify
Thank you, this worked! https://i.imgur.com/PoWDpiM.png
reload maven if you dont have auto reload on
How can I check if a user on the forums exists with the api ?
how would I reload maven? I am new to all of this
well the text is no longer red
probably cause it downloaded the jar like it should
np
might I suggest: https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#auto_reload_maven
wish I could use custom emojis here but whatever
sure I will give it a read
ah I was actually looking at that settings screen before
I think I was playing around with one of the auto complete things in intellij and one of the options was to search for a class you had imported
and it took me to one of those settings pages
Im making a combo duels plugin, whats the difference between setMaximumNoDamageTicks and setNoDamageTicks?
how would i register many commands effiently? most of the time i make a subcommand interface and like do
/command arg
and then get from the map the SubCommand with the arg as a key, how would i apply this method to the command directly?
like /command is the key
Hi, I'm trying to use Gradle toolchains to download J16 as Minecraft 1.17 requires it, but Gradle doesn't download it. I never used toolchains before, so did I forget something? I tried to read the doc on the Gradle's website (https://blog.gradle.org/java-toolchains), but I didn't see something else.
plugins {
id 'java'
id 'java-library'
id "de.undercouch.download" version "4.1.1"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(16)
}
}
(Then, I've the rest of my build.gradle.)
because if that isn't possible i'll have to do like getCommand("").setExecutor(new CommandClass()); like 300 times
Gradle doesn't download java for you
You don’t need both java and java-library
You only specify the target java version in gradle. Your system is responsible for providing the appropriate java compiler
just tell your user "have common sense and dont run gradle on java 8 if the plugin is for 1.17"
It's not related to something with an user. I simply want to try something.
You can use the servers command map to register commands at runtime without having them in your plugin.yml
Tho it is rather hacky
well you've already invoked gradle on java 8, you can't just switch java version there and then since gradle is running on java
you have to use java 16 right from the start
?
Why would they have to use java 16 from the start ?
just change the gradle wrapper version..
from what i see they're trying to switch java version while a java application is running ?
which is
impossible
Oh that is not at a how I interpreted it
i didnt even read their question :P
someone help
these appears every single time i compile
it takes 2 minutes to compile cuz of it
didnt paper change their groupId
Can a Projectile Source be an instanceof player?
whatever you're trying to get from bintray, change it
what are you looking for at bintray? it seems to fail for everything
declaration: package: org.bukkit.entity, interface: Player
ewwwww
shut
no 1.17!
literally goml
can someone help
Why
get on my level
1.8 is trash
idk man did you read it?
hypixel is 1.8.8 jar (well heavlily modified for 1.8.9)
everything that 1.8 "has" can be done using the multitude of available plugins
so is practically all practice servers
but i want 1.17
and duels servers
that doesn't make 1.8 good
i know
hypickle is trash too
so follow the instructions for 1.17
1.8.9 lc is the poggest
Implying Hypixel is a good server lol
¯_(ツ)_/¯
i did
agreed
tell that to all the people who bought something from their store
big yikes
people are stupid
paying money for ingame whatevers
hypixel is a unique server in that their software is "supported" by themselves
there are 1500 players online atm which means there are 1.5k players who have a rank (since rn its closed for everyone unless they got a rank)
nah it shows 1337 rn regardless
my friend gonna gift me rank but i need to be in game lol
They pay developers 6 figure salaries to basically rebuild the game to their needs
windows 10 is the most popular operating system for common users in the world
that people use something doesn't mean its good
people are stupid
Are you implying windows isn't the perfect os
that would be templeos
i like windows
you probably like worshiping satan too
Well let's hope protondb and the steam Linux gaming effort makes progress
Then Linux based OSs might be worth it
I'd just virtualize windows inside linux
Then what is stopping you from doing it the other way around rn XD
moving my files
help pls
oh yeah
what version of minecraft are you using
I was looking for help for you
ok
but answer him
its 1.17 server
are you using java 17
16
rerun buildtools?
what build of spigot is it
did you not run buildtools after switching java versions
And actually make sure you're using the 1.17 jar and not a 1.16 one.
"only up to 15 is supported"
? wdym
1.17 should demand java 16
again, are you sure you're actually running minecraft 1.17
because whatever you are running demands 15 or less
maybe the java path isn't specified for java 16?
i have java 16
are you even reading what i'm saying
then what
literally read
Your server jar
again, are you sure you're actually running minecraft 1.17
ye
Is most likely not 1.17
because 1.17 demands java 16
and whatever you are using says it wants 15 or lower
so something isn't adding up here
lemme see here wait
telephone telephone
is it possible to halt the code of a custom method until the runnable finishes
a runnable inside the method
If you had been using a proper 1.17 jar and using an unsupported version of java this is the error you'd receive:
"Unsupported Java detected (52.0). This version of Minecraft requires at least Java 16. Check your Java version with the command 'java -version'."
yes I like the java -version!
yes, block on a future or use wait-notify on an object
Guys, i'm trying to build the pom for spigotmc and mongodb
but it's giving me an error, can somebody help pls?
Does someone maybe have another idea that could fix that? i couldn't get it
U need artifact Id and version
but it's not finding spigotmc
Trust
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I was registering the ChallengeSettings-Class twice. one time in the registerEvents, and one time in the onEnable itself. i guess that was the issue, because now it works.
Can I transfer ownership from my Premium plugin to another spigot user?
you're not allowed to have multiple accounts. and because there would probably be no reason to transfer your plugin to someone else, i'd say no.
Someone bought the source code to my plugin and they also want the spigot page
Just give them the contents of the page and let them post it
well, premium resources need to be approved... i dont think it get's approved 2 times
thats what i was thinking tbh
?support then
YES!! it finally works how it should... god, what a piece of shitwork
aus ein
means off, on lol
TOTALEN KRIEG
oh no, not that again
how much struggling did you go through to get that 😂
much struggle xd
progress
Hi guys, where can I find some other discords that talks about spigot plugins?
damn, trying to get some more knowledge about spigot plugins
wdym with knowledge
you probably won't find people who will spoonfeed you, if you mean that. most people will just tell you learn basic java, and boom
like I just want to know people that knows more about plugins
no that's spigot people talking about paper plugins
I'm looking for a alternative FeatherBoard plugin for 1.17! It seems that this plugin is the best scoreboard plugin but I don't have 17.99 EUR to buy it
talking about spigot is fine on the paper discord, although it's more of a joke or a laughing stock than anything serious
i dont think much changed in 1.17 for scoreboard
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
conversely, here talking about paper is kind of frowned upon
and some people will throw a hissy fit about it
U have any suggestions?
the spigot forums
literally years worth of archived conversations and discussions about development
https://www.spigotmc.org/resources/quickboard-free-scoreboard-plugin-scroller-changeable-text-placeholderapi-anti-flicker.15057/
try this out, and hope it doesn't use nms
https://www.spigotmc.org/resources/titlemanager.1049/ took me a fucking minute to find you lazy bum
^
it actually was because i registered the class 2 times. so it probably fucked something up, idk
i guess theere was one i used in past, that wasn't that bad looking
great im so proud of you
idk what it was tho
I don't know why you are so rude to a inexperienced user like me, but thanks for the help.
we're not rude
youre not special i hate everyone
gecko isn't rude
you're being sensitive
thx for the help too @sullen dome
gecko is just gecko xd
alright my turn for help
i like that smol duck
how to use openssl to generate keystore file and password for site
bukkit.shutdown()
kiss me
i don't have the effort to capitalize shit
well you're gay
i actually wanted to be cool with smt like Cannot resolve symbol 'bukkit'
but no, you destroyed it
ill destroy you with my big wet sloppy kisses next
:o
where'd you get that avatar
who
i remember you used to have a similar photograph of an actual gecko
ah yes
what a cute thing
what comes after ein
e kleine nachtmusik
what comes after tot
EIN REICH
EIN FÜHRER
god, i'd be good if i would never have been here
do you play mine kampf
more like mein kraft
my base has 6 million furnaces
the game has only been out for 11 years thats not possible
i built 5 thousand furnaces consecutively every day for 7 years
what are the furnace doors made of
sounds like someone was using a hacked client to build that fast...
what the fuck
that's not very holocaust
that's hitler in his earlier years
how did they find this... dashing footage?
back in art school
gecko i love your pfp
anyone know what events if any are fired when a player blocks an attack from a mob, specifically fireballs from blazes
EntityDamage/DeathEvent?
thanks
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(!(sender instanceof Player)) return true;
Player player = (Player) sender;
Location targetBlock = player.getTargetBlock(60).getLocation();
int y = targetBlock.getBlockY();
for(int i = 1; i < 60; i++){
targetBlock.setY(y + i);
if (targetBlock.getBlock().getType().equals(Material.AIR)){
targetBlock.setPitch(player.getLocation().getPitch());
targetBlock.setYaw(player.getLocation().getYaw());
player.teleport(targetBlock);
break;
}
}
return true;
}
any way to improve? / opinions
its a copy of worldedits /jumpto
command i guess
i'm pretty sure you should check for 2 air-blocks, as the player could maybe tp into a 1x1-hole
i mean, just theoretically
true
but except of that, it looks good to me.
just go up til you find 2 air blocks
what does "continue" do
continues with the loop but doesnt run the code after
if(!(aboveBlock.getBlock().getType().equals(Material.AIR))) continue;
so something like this
lets cut it to that
aboveBlock is the block above the block that it first sees as air
you really dont need to make all the methods NotNull
bruh my brain
dont need to use .equals for enums
it made it automatically
intellij
so eh im lazy
must be a plugin that you added
minecraft plugin
thing
how do i make it teleport me to the same position of the block
and not just the corner
like add decimals to the location xd
Location#add
aboveBlock.add(player.getLocation().getDirection().toBlockVector());
```?
ah yes let's add the direction of the player's location to the block
idk how lol xd
mhh i have
now add the decimals to it
what if i want the same that the player had before lol
would splitting it at . and making it a string work
huh
so player's x location % blocks x location
well lets say im standing in the middle of a block, i do /to and i want it to teleport to the same position on the block
yeah
decimals
so how can you take away everything except the stuff after the decimal point?
%

