#help-development
1 messages · Page 1407 of 1
that line does nothing other than inventory.setItem
Well what does index out of bound mean
that the index is out of the inventories range
the issue is that his logic shits out an invalid value to set
we already know it shits out an invalid value but he has no idea how to make it shit out the right value
You cant have a value larger than 53 in an array of 54
smh... Please read the whole conversation, before just assuming.
lol
Im literally just reading the stack trace lol
just make it use rows and columns
well even with your instructions it will be hard for me to do it, as I have never used rows and columns before
using rows and columns means you don't need to compute the index individually everywhere and figure out what a change to the index actually changes in the inventory
it means you can literally tell the item to "be right here"
and then it is there
with sensible numbers like row 3 and column 5
instead of magic index like 34
Is there any code lol
I dont think youve posted the logic that has the slot numbers?
he linked it somewhere
okay, so I have added the column and row into the EntryItem, now for the util method, whats the best way to calculate it?
this i think
if you want a row and a column from the index
row = index / inventoryWidth;
column = index % inventoryWidth;
inventory width of a chest is 9
Looks like you need a page inventory system?
and whats the opposite way, from row and column to index
if you want an index from row + column,
index = (row * inventoryWidth) + column;
Because you have too many objects to put in the inventory
This row and column stuff is good but its not gonna fix ur problem
he's trying to like make animated items or something, i don't quite know
like items that move around in the inventory every tick
or some shit
Mmmmm
he linked a vague gif of something similar earlier but I can't be arsed to find it
If he can rotate the collection then he should just be able to cut off the loop when it gets too high
okay done, so what do I do now? i just do row-- and then recalculate the Index?
https://streamable.com/idxwm4 (the gif)
or exceed the inventory height
makes sense, but how do I know when to stop? should I specify a target column and row, or a target index?
note that the gif has column-- not row--
target column and row
forget about indices
indices don't exist
they're an impl detail
You know when to stop when the thing has gone longer than x ticks
or when column == targetColumn
and put on the brakes if column == 0 or column >= inventoryWidth
the latter shouldn't happen if your when-to-stop logic works properly, but might as well throw it in there
why is my code not working, HELP!!!!!
HALP
define not working
broken
define broken
not working as intended
-.-
hide / show players and change the item
It is intended to work is my guess
lmao
and what does it do
hide / show players and change the item
not work
are you fucking retarded
does your listener run
yes
when I click floor it does
but it deletes the item
and doesent give me the good item
congratulations, you have reached step 1
you have now described your issue
unfortunately all of my effort was exhausted in trying to wrench it out of you
so someone else will have to actually help you with the issue
This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air). For the purpose of avoiding doubt, this means that the event will only be in the cancelled state if it is fired as a result of some prediction made by the server where no subsequent code will run, rather than when the subsequent interaction activity (e.g. placing a block in an illegal position (BlockCanBuildEvent) will fail.```
customcrates
doesn't support custom items and/or is laggy and garbage
make one
also if i did make a crates plugin it'd probably be paid
its easy
i don't have the effort to decorate and polish it
i wish
i already have a million other projects
pick a random number, give an item based on that
whats even sadder is the fact i cant use custom emojis here
what about making it configurable? animations?
bugs?
roulette chest animation?
I dont need a config and animations are a different story
you dont, but a lot of people do.
also im a perfectionist, i wouldn't make something less than perfect
i've been practicing animations and particles and all that
yeah writing a shit tier bare bones crate plugin is easy
^
literally just pick a random item from a list and throw it at the player
writing a perfect crates plugin on the other hand
or near perfect
is another story
i haven't even found a good crates plugin out there yet
they are all either laggy and crummy or don't have proper custom item support
wdym custom item?
like vouchers and all that?
im an animations noob
items with arbitrary tags in their PDC to identify them as custom items from plugins
i had to relearn 8th grade maths
i need to either way for IGCSEs
so i mean it wasn't a waste of time
most of the plugins can handle stuff like lore and display name fine
but like none of them offer support for pdc tags
what 8th grade maths
the whole year worth?
which is understandable, because doing that would actually require some level of competence
which the average developer doesn't seem to fucking have
Pythagoras theorem and trigonometry
that aint 8th grade lmfao
atleast in aus
i learned that shit in 8th grade
I didnt start it till 10
they never said the word till 10th
i bet you'd fail my 9th grade tests lol
tell me one question
one sec ill send u last semester's exam paper
ok
lms
what u gonna do
U LIAR
first few pages are easy
THIS IS GRADE 9
bro i said u'd fail my 9th grade exam
but to fair
you'd fail my 8th grade one too
you only picked this one because you got 50/50 
u want first semester exam?
is this a joke
Player player = dropItemEvent.getPlayer();
Item item = dropItemEvent.getItemDrop().getItemStack().;
a bunch of trigonometry here
how do I get dropped item name?
its easy
you want to put it in a list or smth?
I am new
no just a item name
as a variable
@crude charm dis for u
?
im too lazy to help
bruh
#getDisplayName
ik
that ryhmed
#getDisplayName
twank woo
like I explained yesterday
you first need to get the old value
add + 1 to it
and then write it back
int value = map.get(key)
value = value + 1
map.put(key, value)
do you understand
how is that possible
let's go back to the fucking phone book allegory then
so, your hashmap is a phone book
there are peoples names and peoples phone numbers in it
now, to change someone's phone number
you first need to read it from the phone book
then, you change the phone number
then, you write the phone number back
do you understand?
playerHits.put(key, playerHits.getOrDefault(key, 0) + 1);
you need to read, then you need to modify, then you need to write
what do you mean by old value
how you add + 1 value to HashMap
you want to add + 1
you need something to add the +1 to
you need the value that is already there
you can't add + 1 to nothing
you need a number to add it to
yes howmanyhits is 0
I gave you the code to increment/add an entry ^
but who ?
you
yes thanks but I am here to understand
is the value always going to be 0?
no
then you don't know whether it's 0 or not
so you need to get the current value
and add to it
Then read that code I just gave you until you understand it
its one line of code
playerHits.put(key, playerHits.getOrDefault(key, 0) + 1);
i think his issue is something more deeply rooted
possibly trollism
one can always hope i suppose
I think my issue is that Idk how to like make "howmanyhits" be always 0
why do you want it to be always 0
what's the point of even having it if it's always 0
i don't even know how to explain anything to you anymore
okay, let's
let's make it even simpler
you have a bucket
does .getOfDefault means that it is 0 but not 0
yes
how about
have you ever taken something out of a bucket?
okay, now, imagine you have a piece of paper
he said yes
ok so I only need plugin and listener this
registerEvents
actually no but I can Imagine
good, imagination is good
Hey guys, I need some help with BungeeCord scheduler and async tasks. So, following "Pitfalls" from SpigotMC I should create async task with the code:
getProxy().getScheduler().runAsync(this, new Runnable() {
@Override
public void run() {
}
});
So, my question is can I just call function from another class like:
ProxyServer.getInstance().getScheduler().runAsync(Main.getInstance(), new Runnable() {
@Override
public void run() {
response[0] = GetHTTPResponse.mainCheckEngine(IP);
}
});
Main is the main plugin class, GetHTTPResponse is a class contains static function returns string.
POG
yes
and on this piece of paper, you have written "how many hits"
alr
now, in this bucket, there is a piece of paper
yes
on this piece of paper in the bucket, you have written the number 0
arent u just eplaining me this: PlayerHits.put("howmanyhtis", 0);
yes
but it gets better
now, let's imagine something more complicated
bare with me here
ok
hey, sorry but I didn't get. I already have an event but I only need listner:this and plugin:this but when I type only twice it take event:this and listner:this
have you ever done a hand stand
right, so
The method call is registerEvents with an s.
how many hand stands can you do in a single day?
i assume u want me to say 10
i assume you don't know because you probably have never tried
bc on 10th hit
my bad sorry 😦
now, let's try to figure out how many times you can do a handstand in a single day
now, imagine you have really fucking severe dementia
and you can literally not remember anything
wait
am I going too fast
what is dementia
good acting
no you are not going fast
Thats somethign someone with dementia might say
lol
well, point is, you can't remember anything
how many hand stands did you do up until now? you don't know
you can't remember shit
Idk what is my name
no
Nope, he has dementia
right
okay you have selective dementia
you can only not remember how many hand stands you've made
you bring back the bucket
now, since you can't remember how many hand stands you have done, you need to keep track of them
at the start of the day, you take the paper and write 0 on it
you then put it in the bucket
you then write "how many hand stands i've done" on the bucket
so you know what the bucket is for
what are trying to say is that every time I hit an entity the value will be set to 0
no
i am saying when your plugin starts, you set the value to 0
when the day begins, you write 0 on the paper
because you haven't done any hand stands yet
yes
I do 1 then add 1
and then you go to the bucket
now, you can't actually remember how many times you've done a hand stand
so you find your bucket
you look around until you find a bucket with "how many hand stands i've done" written on it
String item = dropItemEvent.getItemDrop().getItemStack().getItemMeta().getDisplayName();
you eventually find this bucket
this is giving null
then, you take the paper out of the bucket
I am actually imagining that
this operation is myRoom.get("how many hand stands i've done")
that is, you take your room
you look around in it for a bucket with that written on it
and then you take the paper in it
right
now, you can read the paper and see how many hand stands you have made
then, you know how to add two numbers together
you need to read the number, and in your mind, add +1 to it
then you take a big eraser and erase the old number on the paper
and put it back in the bucket
and repeat
this is giving null
in code, this would be
int howManyHandStands = myRoom.get("how many hand stands i've done");
howManyHandStands = howManyHandStands + 1;
myRoom.put("how many hand stands i've done", howManyHandStands);
you find the bucket, take the number out of it with get()
you add +1 to it
then you put it back in the bucket
do you understand what this does now
guys
yes, you need to do that at the start of the day
however, there is an alternative
but imagining it is more complicated
myRoom is your room; it's where you store your buckets
in your code, myRoom is a hashmap
bump, it will take few seconds to tell please
so Player Hits howmanyHandStands is howmany hits right ?
@wraith rapids soo, no matter what I do, nothing happens, absolutely nothing. I get no result but no errors, I have debugged all variables and they are correct. here is the updated code: https://paste.sentinalcoding.eu/4Jew2k7835
no
well imagine you do
is there a way to remove the console kick message on PlayerLoginEvent ?
like the log message
Update inventory
bump (2)
you can't update inventories?
String item = dropItemEvent.getItemDrop().getItemStack().getItemMeta().getDisplayName();
this is returning null
:?
Player.updateInventory
thats for the players inventory, does it update custom inventories too?
items usually don't have display names
display name is only present if a player has renamed the item
Is this what you mean
Map<String, Integer> PlayerHits = new HashMap<String, Integer>();
PlayerHits.put("howmanyhtis", 0);
int howmanyhits = PlayerHits.get("howmanyhits");
howmanyhits = howmanyhits + 1;
show your entire class file
?paste
we are going to build a house
thats not a display name afaik
Yes
yeah, that's what I asked
that's the I18 name
how to this name
Once concern @untold rover
Your array is made of objects that all have the same start index? So theyre all gonna move upwards jn ghe inventory in the same column at the same time
why do they have the same start index?
I can't find it, it's 1.8
+_+
guys is the logger different in 1.16? Can't find the log4j classes that I need, I need to remove some spam
not even the sout above the setitem is triggered
literally NOTHING happens
thats why I pinged NNY with the updated code, maybe he sees what I did wrong
Oh
I didnt know thats what you meant
You call runTaskLaterAsync
You should call runTaskTimer, correct?
oof 🤦♂️
👀
Also you should probably make sure your indexes start off screen. Right now it looks like they just start somewhere and move upwards?
And you also need a check to make sure youre not trying to put offscreen items in the inventory
they start on their target location, and move to the left
column is up down row is left right
row— moves upwards
column-- moves left
as with most other on-screen coordinates, 0,0 is the upper left hand corner
Well youre gonna end up with an out of bounds thing again
yea ik
Just make sure none of the negative indexes are put in the inv
make a boolean method isOnScreen and do if (e.isOnScreen()) inv.setItem(...
and make the isOnScreen method check if row/column is negative, or exceeds the width/height
this is getting frustrating... lets see if it works now, I have added column++ so it has a few ticks on screen before going offscreen and causing an exemption
ig but that'd be cleaner
You dont store inv size
Can anyone help me with forming a regex to match any numbers in a string?
\d+
Its going to move to the right
ik
ok
What are you animating?
that's it?
I just want the inventory content to come in from the right side, as seen here: https://streamable.com/idxwm4
Ok well right now it seems the contents start in the inv and move offscreen
ik, I just want to see it working in thefirst place
Ok
Ahh - fancy
It looks cool
i don't see any point in it
it is, but rn I have 0 fun doing it...
and now teamcity is broken and won't compile properly ...
What is the best way to do item a material system
what
Like right now im using enums for materials i wanna do custom materials and items wondering the best way to do it. cause i feel like enums are not the best way at all
Custom... materials?
custom materials and items sounds like a forge mod
not like a plugin
I guess you can somewhat make custom items
Custom items probably means items that have a certain meta
^
I personally would just define items as a bunch of static fields
just like how hypixel has custom items and materials
But idk what youre using them for
Im going to use them to craft and sometimes place down
Is anything wrong with this ?
Map<String, Integer> PlayerHits = new HashMap<String, Integer>();
PlayerHits.put("howmanyhtis", 0);
int howmanyhits = PlayerHits.get("howmanyhits");
howmanyhits = howmanyhits + 1;
if you want to put howmanyhits back into the Hashmap you get to put it back in so like PlayerHits.put("howmanyhtis", howmanyhits);
If you want to increase the integer in a hashmap
Use HashMap.merge(key, 1, Integer::sum)
Will also put a 1 as a default value if it doesnt exist
I am just confused AF, I had debug code a while back, the debug code is gone I recompiled 20000 times and uploaded, but that debug is still appearing, but when I look at the jar, the debug is not there
Do I need that to increase the value by 1
Still don't get why it is not filtering it ```java
public static void setupConsoleFilter(Logger logger) {
ConsoleFilter filter = new ConsoleFilter();
logger.setFilter(filter);
Bukkit.getLogger().setFilter(filter);
Logger.getLogger("Minecraft").setFilter(filter);
}
I am so frustrated from this I need a beak, Martoph is it okay If I ping you or something once I get back to it?
I gave you this answer
Sure
I may not see it cus this chat is busy
Dm maybe?
yea sure no worries
Isnt that the answer or is it incorrect
I literally told you what to use
.
Otherwise your solution is incorrect
I can give it a crack if you want?
When I do p.sendMessage(String.valueOf(yml.getStringList("locations"))); It says [] although this stands in the file:
'0':
==: org.bukkit.Location
world: world
x: 34.0
y: 78.0
z: -250.0
pitch: 0.0
yaw: 0.0```
Somebody know why it says [] and how I fix this
Sure. Just let me know xd fun little challenge
https://gyazo.com/660e5d6d1ea62d2a7ee49ec792f8f03c
ok my code is incorrect how to use HashMap.merge(key, 1, Integer::sum)
sure anything will help. so here is the newest code: https://paste.sentinalcoding.eu/XMIXv3E557 and the newest error is this: [16:57:00 WARN]: [JaHollDE-Core] Plugin JaHollDE-Core v1.0.0 generated an exception while executing task 7370 java.lang.ArrayIndexOutOfBoundsException: Index 54 out of bounds for length 54 at java.util.Arrays$ArrayList.set(Arrays.java:4356) ~[?:?] at net.minecraft.server.v1_16_R3.NonNullList.set(SourceFile:53) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom$MinecraftInventory.setItem(CraftInventoryCustom.java:108) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory.setItem(CraftInventory.java:99) ~[patched_1.16.4.jar:git-Paper-416] at de.jaholl.core.inventory.ClickInventory.setItem(ClickInventory.java:74) ~[?:?] at de.jaholl.core.inventory.AnimatableInventory.tick(AnimatableInventory.java:51) ~[?:?] at de.jaholl.core.inventory.AnimatableInventory$1.run(AnimatableInventory.java:39) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.16.4.jar:git-Paper-416] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.4.jar:git-Paper-416] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?]
Its missing some stuff, like checks so it doesn't go out of the inventory
I don't know why its trying to set something to 54 even though when I sout everything the highest I get is 53
this will be the new gui system soon :)
Use this for inspiration. Threw it together in a min or two so definitely not too clean : )
new BukkitRunnable() {
private final List<ItemStack> itemStacks = IntStream.range(0, 54).mapToObj(value -> new ItemStack(Material.STONE)).collect(Collectors.toList());
private int iterations = 9;
@Override
public void run() {
for (int i = 0; i < 54; i++) {
final int row = i / 9;
final int slot = i + iterations;
final int slotRow = slot / 9;
if (row != slotRow) continue;
inventory.setItem(slot, itemStacks.get(i));
}
if (iterations-- == 0) {
cancel();
}
}
}.runTaskTimer(this, 80, 10)```
and yes it is vanilla
is this to me?
Yes
Haven't been following along too closely so I am not sure whether it applies to your exact use case.
so basically I have an inventory, full of items they have specific slots, and instead of just opening the invs and the items are there I wanted to have a small animation
so they come in "rolling" from the right side
The code I provided does this.
https://gyazo.com/660e5d6d1ea62d2a7ee49ec792f8f03c
So I suppose your inventory items would be the itemstacks variable. You could swap that out for your own list of items.
ah okay cool, I will save it and take a look in a sec
Just for clarity the iterations variable probably should have been named columnOffset or similar.
somebody know?
what do I have to change?
maybe just a few things, like
- why use a map when it's just a string key
- you misspelled the #put key
- the field name is not following convention
You literally just use it like this
I want to do if Player has hit entity 10 times he will gain strength
But replace key with whatever key you want
What the hell is that and when can I play
And replace HashMap with whateber map object
yes I replaced the key with "hashitmanytimes or cant it be that
minecraft
Well yes but
lmao that looks sick
also it's not my creation I was just saying that soon guis will not need inventories, I'm not that advanced into it currently
yes, command block, custom textures, handling using a minecart
https://paste.md-5.net/bitasocove.java are there any better ways to make this code?
don't ask me what is behind it command block wise as I am working on the same kind of stuff but using the spigot api
what do I have to change?
Probably loop the config section and print the locations.
you can ask the creator of it https://www.youtube.com/watch?v=UhwvK4i_6iU
wow i got over 100 subscriehbers
mom i did it!!
how would i get a list of all the passive mobs in the game?
I mean you can get the livingentities from entitytypes and just remove the ones you don't want
get entity types, get the entity class from the type, check instanceof Animals
how can i save a world in the config file? im currently using
code
return (World) Main.get().getConfig().get("config.spawnEnderDragon.world");
}```
Location spawnLocation = new Location(getWorldSpawn(),getXSpawn(),getYSpawn(),getZSpawn());
Entity enderDragon = getWorldSpawn().spawnEntity(spawnLocation, EntityType.ENDER_DRAGON);```
config file: https://paste.md-5.net/zacirexupe.makefile
yea thats the error i get
but how do i save the world
save it as either World::getUID or World::getName
and then retrieve it as either Bukkit.getWorld(UUID) or Bukkit.getWorld(getName)
cuz later on i have things like getWorldSpawn().getEntities()
UUID is not human readable, but is more robust and accurate
and make sure to null check the return value
as worlds may not always be present
so i save the name of the world
in the config file
and then call it
but i need to cast it to a world
no
public World getWorldSpawn(){
return (World) Main.get().getConfig().get("config.spawnEnderDragon.world");
}
you do not cast it to a world
you can not cast a string to a world
if you save it as a string, you get it as a string
yea but then
you need to convert the string into a world
convert it
if i save it as a string
convert the world name to a world
Does spigot have support for defining custom Tags via code or should I just use a set
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getItem() == null || tracker == null) {return;}
if (e.getItem() != tracker || !stalkers.contains(e.getPlayer().getUniqueId())) {return;}
Player stalker = e.getPlayer();
if (runner != null) {
Player blockrunner = Bukkit.getPlayer(runner);
CompassMeta compassMeta = (CompassMeta) tracker.getItemMeta();
if (compassMeta != null && blockrunner.getWorld() == stalker.getWorld()) {
compassMeta.setLodestoneTracked(false);
compassMeta.setLodestone(blockrunner.getLocation());
} else {
stalker.sendMessage(ChatColor.LIGHT_PURPLE + "You cannot track the runner because he isn't in the same world as you!");
}
tracker.setItemMeta(compassMeta);
} else {
stalker.sendMessage(ChatColor.DARK_AQUA + "There is no runner to track!");
}
}
code isnt running
when i click the tracker compass
and i am in the stalkers list
e.getItem() != tracker
this will never return false
e.getItem() is always a different item than whatever you've set as tracker
== tests reference equality
also known as object identity
a == b it will return true if and only if a is b
use Objects.equals(a,b) instead
or ItemStack::isSimilar
yo, is it possible to change enchantment book enchantment levels to over bukkit ones aka to unsafe enchantment levels
like sharpness 500 enchantment book
ignoreLevelRestriction - this indicates the enchantment should be applied, ignoring the level limit
How can i make snowball invisible?
you can't
did you teleport the armorstand in the player move event
or only once every tick
I teleported armor in a move event, and from another player's perspective, there was less lag, but it was still there
to be honest, I don't know exactly how to do it
how much lag are we talking about
i remember seeing people doing this by teleporting the thing manually and it looked smooth enough to mistake as perfectly synchronous
are we talking like a few hundredths of a block or larger
i want to do that if someone clicks better with an item then i take that item from the player. i tried this but the server crashed. What could be the problem? /with translator, sorry/
what
Is it possible to detect whether a player right clicks with nothing in their hand? The PlayerInteractEvent doesn't fire unless there's something in the player's hand
code:
public class Events implements Listener{
public static String effect;
public static int duration;
public static int level;
public static String display_name;
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getItem() != null) {
if (Commands.requested_item) {
effect = Files.items.getString(Commands.arg_null + ".effect").toUpperCase();
duration = Files.items.getInt(Commands.arg_null + ".duration");
level = Files.items.getInt(Commands.arg_null + ".level") - 1;
display_name = Files.items.getString(Commands.arg_null + ".name");
if (event.getItem().getItemMeta().equals(Commands.wand.getItemMeta())) {
Player player = event.getPlayer();
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), duration, level));
player.getInventory().remove(player.getItemInHand());
// player.sendMessage("asd");
}
}
}
}
}
Don't know if that is directed at me, but the event doesn't fire at all when I have nothing in my hand so this wouldn't work.
uuh
iirc it fires
but it's cancelled by default
if it doesn't fire, there probably isn't much you can do about it
the client probably just doesn't send any packets for it
Unlucky. Alright, then.
Would you help me how to do it? please
well, if you can't get teleporting to work properly
29.04 13:23:20 [Server] INFO org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.5
``` what does this mean
you can hide the slime or whatever by filtering out the packets with protocollib
1.16.5 is not an api version
api versions don't include the minor/patch version number
use 1.16
ok thanks
i think this would be the best solution, i tried to create armorstand and slime with packetwrapper but can't create slime :/
i'm sure a plugin like this exists already
maybe see if you can find an open source one and see what they did
i know at least one exists because I saw some screenshots about one on the paper discord a year or two back
The TAB plugin ro offers, but I am a novice programmer and this code is unreadable to me
ik a bit off topic but whats the permission node to for a default player to tp somewhere
yes
which was the first google result for "show text over player name spigot plugin"
or something
i want the player to be teleported somewhere when they go through the portal but i cant giv them the perms to do it
permission nodes are managed by plugins
yeah im using luck perms
they are also interacted with by plugins
ask whoever wrote whatever plugin you're using for teleporting
hmm but /tp is a default command by mojang
that is like uh
minecraft.command.tp, maybe
i don't remember the format they use
ok let me see but wouldnt they be able to then tp all the time anywhere
when theyll get the perms
yes
that's what the minecraft:tp command does
if you want more accurate control over what the players do, get a plugin that provides a better teleport command
and give them the permission of that plugin
you are also in the wrong channel
yeah ik but why u helping random people when u are not a mod
99% of people who help people here are not mods
there are like 4 mods on this discord and they're active once every few weeks
LOL thanks again u helped me before 2
can we get other payment methods than shitty paypal on spigot
should be able to accept crypto for resources fr
if (i != null) {
if (i.getItemMeta() instanceof EnchantmentStorageMeta) {
System.out.println("It is!");
EnchantmentStorageMeta eMeta = (EnchantmentStorageMeta) i.getItemMeta();
Map<Enchantment, Integer> enchants = eMeta.getEnchants();
NamespacedKey bookKey = new NamespacedKey(main, "UUID");
if (!eMeta.getPersistentDataContainer().has(bookKey, PersistentDataType.STRING)) {
System.out.println("Not multiplied yet");
for (Enchantment ench : enchants.keySet()) {
int oldValue = enchants.get(ench);
Enchantment oldEnchant = ench;
System.out.println(oldEnchant + " " + oldValue);
eMeta.removeStoredEnchant(ench);
eMeta.addStoredEnchant(ench, oldValue * main.multiplier, true);
}
eMeta.getPersistentDataContainer().set(bookKey, PersistentDataType.STRING,
UUID.randomUUID().toString());
i.setItemMeta(eMeta);
}
}
}
For some reason the for loop is not running (the debug message inside it is not working. I cant understand why is that. Enchanted book keySet type is still Enchantment right?
it's probably empty
for loops run once for each element of a collection
if the collection is empty, it runs 0 times
Could some1 help me with world guard on my server? maybe join and show me?
ask the people in #help-server
What does Material.getMaterial(String) accept
It "attempts to get" a material with the name, but that's quite vague
Is it different from its valueOf?
is it nullable? if so, it probably just returns null rather than blowing up with an exception
matchMaterial(String), too, what are these
as for the exact semantics, dunno
i guess I could check the source
@Nullable
public static Material matchMaterial(@NotNull final String name, boolean legacyName) {
Validate.notNull(name, "Name cannot be null");
String filtered = name;
if (filtered.startsWith(NamespacedKey.MINECRAFT + ":")) {
filtered = filtered.substring((NamespacedKey.MINECRAFT + ":").length());
}
filtered = filtered.toUpperCase(java.util.Locale.ENGLISH);
filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", "");
return getMaterial(filtered, legacyName);
}
Oh, I see
Does Material.toString() make it in ...:... format? I'll tias in a bit if you don't know
and the javadoc for the getMaterial one is pretty self explanatory
This is a normal lookup, names must be the precise name they are given in the enum.
it just returns null instead of throwing an exception if there is no matching name
material doesn't override toString
so it just returns the enum constant name
what is sender.getName() when you execute from console?
thx
that you asked that is very dubious
you aren't trying to tell the difference between a console command sender and a player command sender by looking at their name, are you?
if you want to know whether the console sent it, if (sender instanceof ConsoleCommandSender)
^^^by 1000% he is correct
anyone know how to make some rankshop like this?
that's a gui
Yes
not a rankshop
anybody has any ideas how to play with the particle render distance?
There doesnt seem to be any render distance integer in spawnParticle
only spawnEffect
or playeffect
or whatever it was
particles are very abnoxious to work with
Listen to packets and cancel them if they're outside the range
they lack support from clientside to make them how you want them
Make sure you've added customjoin to your plugin.yml
how would this look like if you can give an example
ive not worked
with particle packets
onEnable() -> 16 line. Value is null
and not with packets alot
Have you worked with Protocollib before?
Alright I'd recommend using that to make your life easier
that would work only for smaller render distances. Increasing is not possible via server side
aight
I have it
So theres
A packetlistener
for particles there?
I mean the thing is
My plugin sets 1 player to generate permanent particle trail behind him
And there are followers who need to follow it
And if the particles are enough blocks away from whatever player
can you tell me the whole path to import, IDEA doesnt know it
oh and yeah this is apparently possible. You can send long distance particles with up to 65532 blocks range
no it doesnt
Aight
Idk how to exactly use them tho
so if you could give me an example
that would rly help
this one right?
Yes
Aight
any1 can tell me how to make something like this?
Are you coding or looking for a plugin
talking to me?
no
olivo 🆒
Now do this to register your listener:
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
@Override
public void onPacketSending(PacketEvent event) {
Player player = event.getPlayer();
WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(event.getPacket());
//Handle the distance check and cancel etc
}
});
@vital ridge ^^
Okay but
Gotchu
the code makes sense
and i understand it
but
Is this working for per player
Yes
Gotchu
Yeah my example contains that
particle is the packet right?
yeah it is
WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(event.getPacket());
Yeah use packet.getParticle()
Mhm thanks ill finish it
hey, would it possible to do this:
item that when used spawns a random structure infront of them, conditional to the world there in (if in overworld, possible structures would include: Village, Ruined portal, Pillager outpost, ocean monument, stronghold, ect. Nether structures would include: Nether fortress, Bastion, Ruined portal. End structures would include: End City.
Yes that would be possible
are there any forums on it that i could look at?
Not that I know of
If this is your first plugin I'd recommend starting with something easier
not me whoes doing it, im just the person whoes requesting it 🙂
Might need some updating
i will show this to the person
?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/
can you make aliases in bungeecord?
Heya 👋 - Without using 3rd party software, is there no better way of checking if a player has entered a region other than listening on PlayerMoveEvent or something like that and checking if there are any worldguard regions?
Obviously PlayerMoveEvent would be reallly lagy
are you sure { goes after the manager.addpacketlistener method
shouldnt it be ;?
i mean you could use packets
No your overriding data inside of the packet adapter object
So the {} goes around the override
._.
You only extend your main class with JavaPlugin
Not every single class
Use Dependency Injection
lmao
What is the best way to manage items and materials both custom?
somehow
public class ParticlePacket implements Listener {
private FollowMe main;
public ParticlePacket(FollowMe main) {
this.main = main;
}
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(main, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
@Override
public void onPacketSending(PacketEvent event) {
}
});
}
depends on what functionality these custom paraphernalia have
what you mean?
what are those items and materials for
and what do you want them to do
what functionality categorizes them as custom
Olivo did you write your code in your IDE, cuz mine giving me lots of errors with parantheses
not lots but few
I wrote it by hand directly in to discord
Yea well its telling be the packetadapter is undefined
Starts Intellij to double check everything
materials for crafting, custom blocks to place down and get the materials, custom items like how hypixel skyblock has there items where you can right click and it does special stuff and things like that
oh okay
Also you need to put that code inside a method
i wish spigot had multiple channels
You can't just run code outside of one
I mean the packetevent thing
is also
a method
isnt it?
or its smthing different
that can be used
Idk I mean just make a design which contains somewhat scalability ninjablader
i mean ye but like what would that system be
I would make some sort of registry for all the items/materials and then continue from that
@chrome beacon if i want to get the particles location, do i have to only work with x y z? Cuz i cant seem to find getlocation or smthing
(Might be somewhat similar to an enum or just a pseudo enum (assuming you want some sort of generics involved which might not be a dumb idea to distinguish types))
i mean simply id do p.getlocation.distance(e.getparticle.getlocation)
but i assume this here is not that simple
and i didnt find the location method
Location particleLoc = new Location(p.getWorld(), packet.getX(), packet.getY(), packet.getZ());
just the packet confused me lil bit
didnt know if it takes the actual particle
Hello! is it possible to open a 2x2 crafting inventory using a command?
(the one with the player's equipment)
It's not possible
D:
Why do you want to open the 2x2 one
Olivo, only calling my method now will start the particle event?
or it works like a normal one?
I mean i have it registered
Once it's registered you're done
gotchu
Every single particle will be sent through that
(Keep in mind there are some client particles that the server can't change)
I see
Im using redstone particles
and spawning them also with my code
so i should be fine
I need to have protocollib on my server also
right?
Yes and PacketWrapper
@chrome beacon you sure only registering in main class is enough?
I added some debug messages
and the event seems to be not running
Are you registering it
yes
Put some debug messages and make sure the register method is run
annotated?
i added debug messages
i registered the method
heres my code
the event*
public class ParticlePacket implements Listener {
private FollowMe main;
public ParticlePacket(FollowMe main) {
this.main = main;
}
public void PacketListener() {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(
new PacketAdapter(main, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
@Override
public void onPacketSending(PacketEvent e) {
System.out.println("true");
Player p = e.getPlayer();
WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(e.getPacket());
Location particleLoc = new Location(p.getWorld(), packet.getX(), packet.getY(),
packet.getZ());
if (p.getLocation().distance(particleLoc) >= 10) {
System.out.println("Loc true");
e.setCancelled(true);
System.out.println("cancelled");
}
}
});
}
}
Aight now send the main class
public class FollowMe extends JavaPlugin {
static HashMap<Player, UUID> playerToFollow = new HashMap<>();
public static boolean eventStatus = false;
public static Player p;
public static UUID playerToFollowUUID;
public static Location spawnLoc;
public static Location trailLeaderDeathLoc;
public static boolean confirmation = false;
public static boolean bounceBackStatus = false;
@Override
public void onEnable() {
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvents(new ParticleTrail(this), this);
pm.registerEvents(new JoinEvent(this), this);
pm.registerEvents(new PortalTravelEvent(this), this);
pm.registerEvents(new DeathEvent(this), this);
pm.registerEvents(new DamageEvent(this), this);
pm.registerEvents(new ParticlePacket(this), this);
getCommand("followme".toLowerCase()).setExecutor(new FollowMeCommand(this));
getCommand("followme".toLowerCase()).setTabCompleter(new FollowMeTabCompleter(this));
}
}
Where are you creating the PacketListener
in my events package, ParticlePacket class
No annotated event to register
merge your listeners owo
merge my listeners?
y have any idea what could be wrong?
so how should i register it since its not annotated?
PacketListener isn;t a Spigot event
You can't label it a Listener class and expect it to register as a listener
I'm going to assume its an event from Protocol lib
y
Just guessing then add the annotation to PacketListener @EventHandler
Its still not doing sht
Why do you have a method inside another method? onPacketSending is inside PacketListener . Makes me think you have it all wrong.
Does your IDE not have a warning on the overide of onPacketSending?
it doesnt
Well for starters, you can;t have a method inside another method
Your IDE shoudl be throwing a fit
I know that, It's just made me think that there are exceptions or smthing
Using the protocollib api
Ive never used it before
Ik the basics tho, so that completely my fck up
is there an event for when a dispenser places a block? i.e a skull
yeah
I'm trying to make/implement an event for when creatures are "built" (hopefully pr'ing too)
so I'm trying to figure out how to go about it. Basically, I'm not sure how to deal with the fact both a dispenser and a player can "build" Golems and the wither
CreatureSpawnEvent#getSpawnReason
yes but I can't get the blocks transformed
the event i'm trying to add will preserve which blocks were changed into air
how do i give leather armor a special Hex code
LeatherArmorMeta
hello (sorry for my english), I just start to try plugin dev, and I saw tath inventory.getName() does not work anymore. But I also saw tath a lot of peopl say tath it's a bad practice to use getName() ( in order to check inventory) so what could I do in my case please ?
use an InventoryHolder object
or store open inventories in a Map<UUID, InventoryView>
oh thx !
new Random()
no
make numbers more rare the higher they area
are
im making a levelling system on mobs
and i want lvl 1 -10 to be most common
and level 100 to be very rare
gaussian
java.util.Random.nextGaussian() Method - The nextGaussian() method is used to get the next pseudorandom, Gaussian (normally) distributed double value with mean 0.0 and standard deviation 1.0 from thi
how would i use this
hmm... theoretically, is there a max to nextGaussian?
(int) (Math.max(2, Math.abs(rand.nextGaussian())) * 50)
is that it
i have no idea
looks like it'll work to me
cuz lvl 100 creepers have a 20 block explosion radius
and break shields basically instantly
you could also make it max(4, Math...) * 25 for even more lower levels
this aint right
oh lol
bout to have lvl 100 creepers all around the place
does the game look good lol
How can I give player item based on mysql query number? Like I want to do it async, but is there a something, that I can use to wait with giving the itemstack until the async query is done?
you can;t stop or pause an event
are you still using min(2,...) * 50?
you can change those to your liking as long as the replacements multiply to 100
like if the following code is under bukkit.runtaskasync() will trigger after the async task is done?
i suggest trying the 4 * 25
im doing * 20