#help-development
1 messages · Page 2173 of 1
Well, looking at your code. You first check if the claim owner is the same as the one in the event. If that is true, you keep the event running due to the event.setCancelled(false). If that check fails, you then check to see if a list of flags does not contain a build flag. If it doesn't contain that flag, send the message that you can't build. That's what I see at least.
Sometimes looks like im trolling but most of the time i just dont realize what i rite because im annoyed
send to shadown?
shadown?
shadow*
Who’s shadow?
I cri, conclure doesn't realize.
hi, when i am installing my plugin in my server i got this error : error "class file has wrong version 62, should be 55" can someone help me ? i tried to change jdk version in my Intellij projet strucutre but no matters still have the same error..
Please fill me in lol
Have you trying invalidating cache?
He's referring to me.
Oh
yeah
Dont worry i dont feel alone know
how ?
jeesus
Yo Conclure you might want to get some sleep
True that
yeah go to sleep my gf
wtf
Its 4am there
Gn yall Ig :3
Gn
See you soon ❤️
is that a threat?
random question
Only if you want it to be 😉
This is an issue with what version of java you are compiling with. This could either mean that your server is running on an older version of java and can't support the newer plugin. It may also mean that your project is using a newer java version that isn't supported yet. (For the servers)
Try compiling your project against java 8 or 11.
you know how when you place a block in the same spot as grass and lichen and stuff the block will just replace them, is there a way of checking if a block is one of those types of replaceable blocks
I think there is an event call BlockChangeEvent. It might get fired when that happens.
i tried java 1.8 and jdk 11 but still saying that my class file is 62 ans server is running 55
How are you compiling your project? Maven, Gradle, or manually?
maven
Make sure these properties are set in your pom.
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
62 is java 18, 55 is java 11 just fyi
yep
but my intellij is still compiling with 18 even if i have put 11
Shouldn't if you are doing it through maven.
You could check your project settings and set the jdk to java 11. Then change those properties to 11 as well.
intellij? more like dumj! hah!
Can I dm you to send you screenshot ? I can’t send here
Sure, but you can also send images here with imgur if you aren't verified yet.
Try refreshing your project after you set that. Then try recompiling.
Already done..
And? What's the result?
To sleep a player on the floor i need to use an fake entity right?
To compile I need to double click on package right ?
Yes, but I'd run clean first then package.
might have to put it as a configuration tag for the compiler plugin in maven
You can also set a defaultGoal in your pom so that you can just click the green play button and it will execute them both automatically.
<build>
<defaultGoal>clean package</defaultGoal>
</build>
Maybe, but can't you remove the plugin if you have those properties set?
Still having the same issue
that link I posted is another way to have maven set the JDK version
Do you have the maven compiler plugin in your plugins section?
Hmm, you may need the compiler plugin then.
i need to add this to my pom ?
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Yes, but the source and target would be 11.
aight
clear caches
The first i told him
okay its working now
your welcome
i mean right version
Just go ahead :D
on maven, where do i need to put my config.yml ?
The folder called resouces
might have to make that folder yourself
Not if using intellij
Mines intellij generate the project ith every directory
but after compiling got this
?
did you add config.yml to that folder?
you didnt create it
and are you using the appropriate methods when enabling to have the server copy it from the jar?
third
here is a link to help update plugin.yml version number without having to edit it all the time
frost where i can know what paremeters does the maven-deploy-plugin hve?
i have
so to have deploy work you need these bits
Did you create it/put it on the resource folder?
here
bits, arent called parameters?
As we can see it doesnt exists
Very confused, what does this mean? ```Caused by: java.lang.NullPointerException: Cannot invoke "java.util.HashMap.put(Object, Object)" because "net.tazpvp.tazpvp.Tazpvp.sellables" is null
at net.tazpvp.tazpvp.Tazpvp$1.<init>(Tazpvp.java:64) ~[tazpvp-1.jar:?]``` ```java
public static HashMap<Material, Integer> sellables = new HashMap<Material, Integer>(){{
sellables.put(Material.DEEPSLATE_GOLD_ORE, 1);
sellables.put(Material.DEEPSLATE_IRON_ORE, 1);
sellables.put(Material.DEEPSLATE_REDSTONE_ORE, 1);
sellables.put(Material.DEEPSLATE_LAPIS_ORE, 1);
sellables.put(Material.DEEPSLATE_EMERALD_ORE, 1);
sellables.put(Material.RAW_GOLD, 1);
sellables.put(Material.RAW_IRON, 1);
sellables.put(Material.REDSTONE, 1);
sellables.put(Material.LAPIS_LAZULI, 1);
sellables.put(Material.EMERALD, 1);
}};```
Then in your properties file for maven, is where you secret key stuff goes for your server
I know how to use deploy plugin i just want to know which parameters sent in the request
Hmn
it sends your jar, a signature file
etc
the wagon plugin is what dictates the connection type
I need the exact params because TS project its crying me saying that the params are not specified
Oh i didnt explain
it is what most likely it is complaining about unless you didn't specify the appropriate wagon plugin
I done my own express typescript server
then its up in the air on the problem since you have a custom server
So im setting the deploy-plugin my ts server
That why i just need to know the exact params the plugin sent in the request
XD
Wagon plugin??
yes
I dont use wagon plugin
that is why then
so in my server tutorial when I had my server, I had an ftp server so I used the wagon ftp plugin
there is one for SSH and HTTPS
Sorry for bein rude but i dont understand you
Im just wondering to do my custom maven server
i just opened the jar and there is the config.yml
the link above tells the deploy plugin, which type of connection to initiate to the repo server
i dont know what it isnt recognizing it
not sure what is so hard in understanding about the wagon plugin extension
I dont use that
and I am telling you that is your problem
how else you suppose to send credentials?
which credentials?
Im just trying the maven-deploy-plugin do a request to my ts server
to know the parameters i need to parse in server side
so was I
he dont get angry i will use the translator
obviously I have used the deploy plugin successfully
either it works for me by magic
or I am doing something that you are not
I used translator, so from what i read you telling me to use another plugin but i didnt understand you
Now that i translated i understand
did you even look at the link above?
notice it is below the deploy plugin as an extension?
that is because it tells the deploy plugin in how to initiate the connection and what to send, credential or no credential
Ohhh
i thought the wagon plugin tells the server how to initiliaze
That why i was not following you
That why i cannot live on an english country
if you are going to use credentials
deploy plugin pulls that from the settings file from maven
this way you don't put credentials in the pom for everyone to see 🙂
My webserver doesnt have any credentials its just literally a post request listener
well just letting you know
Which debug to console what receives
Yeah i learnt when used for first time they always go on a setting file
might have to create a server tag in settings still
even if no credentials being used
ok
How?
<server>
<id>testing</id>
<url>https://localhost</url>
</server>
If ima not wrong
Does anyone know how to get maximum data value?
Data value? about what?
of?
might just have to hardcode them i think
i know i can do item.getData().toString() to get GOLDEN_APPLE(0) and GOLDEN_APPLE(1) or WOOL(some number)
but i wanna know the max number
?jd-s
There you can find all the values from Item#getData()
Hello, im trynig to spawn a armorstand to the center of a block, java int x = (int) p.getLocation().getX(); double y = p.getLocation().getY(); int z = (int) p.getLocation().getZ(); ArmorStand a = (ArmorStand) p.getWorld().spawnEntity(new Location(p.getWorld(), x + 0.5, y, z + 0.5), EntityType.ARMOR_STAND); this code only works in one corner of the block, when standing in other corners it goes off to the next block.
#getX()?
no why?
or will that already center it
It will already center
Sweet thanks
Try it
kk
But i think it should center it
Your welcome
Have a lovely night/day
Its possible to a entity following you, like does hipixel anticheat?
Will there be problems with server resources if I use a hash map?
well if it becomes large
but everything takes resources
however, compared to other stuff like IO, no HashMap is generally considered cheap given the time complexity it offers for certain operations
Anyone here know how to use "Night Config" the library for configuration files? If so, I am trying to create a multiline string and I create it like this:
spec.define("test", """
Line 1
Line 2
Line 3""");
But when it loads it in the TOML file, it shows up like this:
test = "Line 1\nLine 2\nLine 3
I'd like it to show up like this in the TOML file, though:
test = """
Line 1
Line 2
Line 3"""
Why using tomó?
I prefer to use TOML
Also please provide the link
Link to...? The library?
Yes please
I will check it
whats the chat clear shortcut ingame?
was F3 + D
So basically I'm trying to filter some words in the chat, I have the filtered words in a file, the problem is that for example if I have "fuck" and "fucking" in the file and someone writes "fucking" in the chat it comes through as ####ing instead of #######, how would I fix this?
use the longest word it matches
Is there any simple way of checking if a itemstack is a pickaxe of any type?
or do I just make a list and call it a day?
get it's material and check if it contains "pickaxe"
Check the material name
oh sweet
it would be in all capitals correct?
p.getInventory().getItemInMainHand().getType().name().contains("PICKAXE")
Yeah all capitals
I guess
Alright ty
if not you can always just set it toLowercase() before checking if it contains
If that doesn't work you can try #endsWith("_PICKAXE")
got it
guys it's not possible to have an item in an inventory which doesn't show the dark purple name window
right?
even if you set custom name empty it displays little box
dark purple name window?
client side
public void OnEntityDeathEvent(EntityDeathEvent e){
if (e.getEntityType().equals(EntityType.IRON_GOLEM)){
e.getDrops().remove()``` Trying to make a custom entity drop plugin and for iron golems I dont know the how to remove poppies from the drop list.
use == for enums
oh you only want poppies to get removed?
yes
probably use filter for the list
e.getDrops().stream().filter(entity -> );
is there a way to set the drops?
you cant use filter for that bc you cant set the drops
then iterate through each ItemStack in getDrops and remove it when itemstacks Material == Material.POPPY or smth
e.getDrops().remove(Material.POPPY); not just this?
I think that would not work bc e.getDrops() returns List<ItemStack> and Material.POPPY is not an ItemStack
that wouldnt work
Man I have no clue how to write this
okay let me help you
so normally I would use filter in this case, but that uses streams and returns a new Collection at the end.
nvm we can use filter :D
Alright
e.getDrops().stream().filter(entity -> ).collect(Collectors.toList());
this returns a new list
now we can remove everything from getDrops
and use the e.getDrops().addAll() method
btw you need to write smth in here (entity -> )
I have created a function through which we can customize spawnrates how can i turn it into api?
what do i write?
(entity -> entity.getType() == Material.POPPY) should work
not entity
its an itemstack
just change the variable name
(itemstack-> itemstack.getType() == Material.POPPY)
e.getDrops().stream().filter(itemStack -> itemStack.getType() == Material.POPPY).collect(Collectors.toList());
yea probably
I'll test brb
did you do this stuff
now we can remove everything from getDrops
and use the e.getDrops().addAll() method
Well If I'm already removing the poppy wont that just leave the iron?
I think its itemStack.getType() != Material.POPPY
I think so, but what you do now depends on what you want at the end
I believe I've already reached the end, all I want is the iron to drop, then when I get that working I was going to implement more mobs and custom item drops
I just needed to write the iron golem one so i could learn how to remove and add items to an entities death event
👍
Thank you for the help, testing brb
oh real quick, I have this written in my main class do i still have to register the event?
Or should I quickly register the event and move it to a separate class
public static GameProfile getGameProfile(Player player) throws Throwable {
Object entityPlayer = PLAYER_GET_HANDLE.invoke(player);
Method m = entityPlayerClass.getMethod("getProfile", GameProfile.class);
return (GameProfile) m.invoke(entityPlayer);
}
I'm new with reflection and am wondering if this would cause any problems.
The warning I get with the last line is "2 arguments expected", but it's a get method, so there are no arguments within the method I'm trying to invoke
probably read docs
thank you for being so useful
it only needs more arguments if the Method got arguments you need to pass
great thank you for the answer
for example:
public static void test(int a) {
}
m.invoke(obj, arguments)
first argument gets ignored and can be null if the method is static
the second argument(s) is an Object array
you dont need to pass any if your method dont have any parameter
and sorry for helping
but dont ask question, which you can easily look up in seconds
you know what's crazy
how my question could've been answered here within the first 2 seconds without the sass
I was simply asking for confirmation
and I answered it
[04:54:13 WARN]: java.lang.NoSuchMethodException: net.minecraft.server.level.EntityPlayer.getProfile()
public static GameProfile getGameProfile(Player player) throws Throwable {
Object entityPlayer = PLAYER_GET_HANDLE.invoke(player);
Method m = entityPlayerClass.getMethod("getProfile");
return (GameProfile) m.invoke(entityPlayer);
}
does anyone know anything about ports? Im trying to release this plugin I made that relays information using sockets. We opened up the ports, but the connection gets instantly denied, any ideas?
How can i make a book system on first join(rules, how to play)
hello, im making
public void OnjoinServer(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.getInventory().setItem(9,getMenuItem());
}
public ItemStack getMenuItem(){
ItemStack sbmenu = new ItemStack(Material.BOOK);
ItemMeta meta=sbmenu.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + "Skyblock Menu");
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY + "View all of your Skyblock");
lore.add(ChatColor.GRAY + "progress, including your Skills");
lore.add(ChatColor.GRAY + "Collections, Recipes, and more!");
meta.setLore(lore);
sbmenu.setItemMeta(meta);
return sbmenu;
}```
but i didnt get the item when i join the server with plugin loaded
what is FastReflection? is that an lib or smth
yeah
how do you change the message that says "unknown command type /help for help"
which one
it comes with fastboard
and I cant find an EntityPlayer in nms.level
EntityPlayer is found with the method, but we need to find EntityHuman I believe as that's the superclass that has the getProfile method
I mean there is no class in net.minecraft.server.level that is called EntityPlayer
I'm using paper as well
but as you can see
it was found
just not the method since it's in the EntityHuman (superclass)
but you get an error
I get an error for the method not the class
yea I see thats weird
I see it
in the decompiler
😐
that's bullcrap
public static GameProfile getGameProfile(Player player) throws Throwable {
Object entityPlayer = PLAYER_GET_HANDLE.invoke(player);
Method m = entityHumanClass.getDeclaredMethod("getProfile");
return (GameProfile) m.invoke(entityPlayer);
}
what you're using may have wonky mappings
I'm using one of the patched jars in the cache folder in jd-gui
idk I cant find it :D
Paper 1.18.2, and I search in intellij
repositories {
mavenLocal() // (1)
mavenCentral()
maven { url 'https://papermc.io/repo/repository/maven-public/' }
maven { url 'https://oss.sonatype.org/content/groups/public/' }
maven { url 'https://repo.dmulloy2.net/repository/public/' }
maven { url 'https://libraries.minecraft.net/' }
}
dependencies {
paperweightDevelopmentBundle 'io.papermc.paper:dev-bundle:1.18.2-R0.1-SNAPSHOT'
compileOnly 'io.papermc.paper:paper-server:1.18.2-R0.1-SNAPSHOT:mojang-mapped' // (1)
compileOnly 'io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT'
compileOnly 'com.mojang:authlib:1.5.21'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0'
implementation 'org.mongodb:mongo-java-driver:3.12.11'
implementation 'org.reflections:reflections:0.10.2'
}
try ServerPlayer
so I dont need it
it depends on what mapping you're ob
ServerPlayer is EntityPlayer
renamed
remapped
and do you see the getProfile method?
well let me check that, but need to go to school after that
there is no getProfile method in ServerPlayer, but it extends Player
😩
this would be much easier without needing to use reflection 💀
dang
alright seeya
weird how it's not in the EntityHuman class on 1.18 but it is on 1.17
apparently spigot dropped their named methods on 1.18
😐
I was looking at the 1.17 version
are you using mojang or remapped mapping
for what
nms
I'm using the obsfucated stuff the default paper jar provides
are you using maven
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
oh no there's nothing wrong now
regarding that method
there's a new problem with what I'm trying to change though
which line?
"name" doesn't exist
I'm like 85% sure name is a property name
probably another culprit of spigot getting rid of named methods and stuff
the property is probably a letyer
yeah dunno sorry
💀
use Player#hasPlayedBefore()
id provide u with a code example but i code in kotlin sorry
I haven't even touched an ide in over a year but I wanna get back into development, how should I go about refreshing my memory?
How to show a book
Hi i have made a plugin and i have a problem with that it crash my server after som hours. Tag me pls help i need it to stop crash i crash more then 20-30 times a day
i don't get any errors or crash reports
Exactly the same as yesterday. Your while loop never exits once it hits teh last message
Hmm is there anything i can control about not closing the book till coming the last page
no
Can player close it on first page?
Try create a basic plugin I guess?
I'll just go on from where I left off and see if I can learn from what I was doing
You are going to look at your old code and wonder WTH you were thinking
Happens to me every time
Calculator
Probs yeah, I remember having a bug that looking at it now I was an idiot for not fixing because it works in one way but not another
This is the shittest moment
I think I've messed up my pc by deleting some stuff
isnt the error too obvious
Ik I'm fixing it rn
One question, I can’t figure out how to make the gui signs where you write the text and then confirm... I’m finding some APIs but they are now out of use, for the rest, I can't find anything useful with ProtocolLib that explains me how to do this... Any ideas?
I completely deleted my JAVA_HOME variable when I deleted java 8
does somebody know how can I change the colors of leather armor after sometime
personally I would make a beautiful store of all the armor through an arraylist and then a loop asynchronous task that retrieves the meta and changes color
//Code from spigot
ItemMeta meta = item.hasItemMeta() ? item.getItemMeta() : Bukkit.getItemFactory().getItemMeta(item.getType());
LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) meta;
// from RGB:
leatherArmorMeta.setColor(Color.fromBGR(10,50,100));
// from Color:
leatherArmorMeta.setColor(Color.FUCHSIA);
item.setItemMeta(leatherArmorMeta);```
If instead you do not want to make a loop, simply a task like that that after some time removes that object from the array and then does not change more color
it crash befor it gets to the last and how does i fix it
You need to exit the loop
Just like ElgarL said it gets stuck forever in your while loop
Look at this loopjava while (nextMessage == lastmessage) { random.nextInt(messages.size()); }Once that condition (nextMessage == lastmessage) is met your loop starts. The code inside the while loop needs to alter the condition to allow it to exit. It needs to change the value of nextMessage or lastmessage.
and how can i fix it?
They already told you?
can I give you a simple advice?
message = messages.get(0);
lastmessage = 0;
}```
Try with a e.printStackTrace right there...
wc
Or just make sure it's always in bounds instead of using try catch
sure, but if he's having an error without a stacktrace... That's the "Why"...
try with printing the stacktrace and check what is the error
There is no error. They triggered the auto stop because of their infinite loop
can you show the array loop example
Basically you need to find the armor item stack. You will have to loop the player inventory and find the leather armor you want and then modify the item meta
Is there something that checks if it contains and returns the item if so
the inventory?
ouch yeah
but you would have to loop the inventory to find all matching item stacks
no I want to loop through colors in a array and i want it to go to second color after a runnable runs
no I dont want to find it in the player inventory
i want it to run when I run a command it should dye the leather armor first with Green color and then after 1 sec it changed it to yellow
All you really need is to have an index variable and increment it every time the runnable runs
and reset it to prevent it from going out of bounds
Example?
hey, does someone can help me i am getting this error :
Error occurred while enabling DSCraftFRPL v2.0.0 (Is it up to date?)
java.lang.NullPointerException: null
at fr.starxx.dscraft.DSCraft.onEnable(DSCraft.java:257) ~[?:?]
Looks like something is null on DSCraft.java:257
@chrome beacon ?
You should be able to get a value from an array with out me writing it out for you
if not it's really time to learn some basic java. You need to know it to write Spigot plugins
huh
{
public void run()
{
}
}, 20, 200);```
ik about this
but
why not
It's not designed for that
Sync*
You're asking for things to break
I want an array list that goes from one Color in array to another in a runnable
You don;t need an array if you are literally switching two colours
how?
Set color, start delayed runnable, runnable sets new color
new BukkitRunnable() {
Color[] colors;
int index;
@Override
public void run() {
if(index >= colors.length) index = 0;
Color color = colors[index];
index++;
}
}.runTaskTimer(this, 20, 20);
It's really just something like this
ok
Spoon feeding
Yeah I'm aware
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?spoon Looking for this?
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Nop, I knew it x)
Was just curious of various commands of this bot
olivo what do you think about that?
int i = 0;
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
public void run() {
for(ItemMeta meta : itemMetasArray) {
ItemMeta meth = meta
if(i > 0) {
i--;
} else i++;
meta.setArmorColor(colors[i])
}
}
}, 0L, 20L);```
That won't work
r u sure?
This is my runnable for a rainbow entity.```java
new BukkitRunnable() {
int colour = 0;
@Override
public void run() {
team.setColor(ChatColor.values()[colour++]);
if (colour > 15) colour = 0;
}}.runTaskTimer(this.plugin, 0, 5L);```
as simple as that
No you can't store the ItemStack directly
new BukkitRunnable() {
final Color[] colours = {Color.AQUA, Color.BLACK};
int i = 0;
@Override
public void run() {
for(ItemStack armor : armors) {
LeatherArmorMeta armorMeta = (LeatherArmorMeta) armor.getItemMeta();
armorMeta.setColor(colours[i]);
i = this.i == 1 ? i-- : i++;
armor.setItemMeta(armorMeta);
}
}}.runTaskTimer(this.plugin, 0, 5L);
}```
ahhh you mean the memory leak
No
oh
It won't update in the inventory
so you can't do nothing for that x)
or you can serialize the Player's armor (Player & ItemStack), and use a listener for active updates of the array
do you ppl know how can I create a config file and read from it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so many to choose from 🙂
😏
LOL
YO MAN THE COLORING ARMOUR WORKED, THANK YOU SOOOOOOOOOOOOOOOOOOOOOOOO MUCH
and config.addDefault("youAreAwesome", true); config.options().copyDefaults(true); saveConfig();
if I want it to be stored in a folder how can I do that
Look at this guide then
but how can I reload the config it doesnt include it
I get the feeling you are not reading the wiki at all
I am
it tells you how to save and load
oh wiat
but it doesnt has the load
but wait let me try what i got
look at teh first code block in the Using Custom Configurations section. it has save and load
if you are talking about the built in config then Plugin#reloadConfig()
ok
ITS NOT WORKING
its giving me an error
thats is this:
at me.unrealmanni.magic_armor.commands.Rainbow.<init>(Rainbow.java:25) ~[?:?]
at me.unrealmanni.magic_armor.Magic_Armor.onEnable(Magic_Armor.java:17) ~[?:?]```
because "this.plugin" is null
HOW
Rainbow.java:25
this is the code at that line:
color_speed = Integer.parseInt(Objects.requireNonNull(plugin.getCustomConfig().getString("rb_color_time")));
you have not set plugin to a value
wdym
plugin is null
can you fix that
from this
?paste You will have to show me the whole class
oh wait I got something
it fixed that but now its giving me an error that The embedded resource 'custom.yml' cannot be found in plugins\Magic_Armor-1.0-SNAPSH
oh but wait
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Return longest string containing message
I just wanted to read, don’t worry
If anyone has an idea on how to fix the above ^
with?
Red sky at night is supposed to a good sign
However, I don;t use ProtocolLib
sorry
thanks
nono that was the prob
thanks
lol
I wanted to do something less useless in my life and I thought to make a sign where you write ur text and save it in the config or idk, without placing the sign but nothing, the only plug-in that does is obs. _:
protocollib seems the only light in the dark sky
but I'm hungry rn
can you get the position and value (text) of a sign?
I just want to open the sign gui to player
then save the text when the player saves
I don't want to place anything
so no block, no position, no data.
only packets I think
Ok
that's an atm plug-in
so this has nothing to do with sign then. Hmm, so what you basically need is a text input gui and a gui for displaying the card
i just want something like that
basically this?
ahaha
second thread there is a link
to the one I just send you
hf bro, you might need to change some code since this is 1.11
what fun! I'll definitely have fun! Thanks
"...I just managed to get this working after not finding any recent Threads about it or getting help :eek:. Because I don't want you to endlessly wander the Internet I figured I make a post out of my solution."
ahahah
I always tell people that successfully googling things is a skill you can state in your CV
It's quite true
https://www.spigotmc.org/threads/signmenu-1-16-5-get-player-sign-input.249381/
found directly for the version I needed in the same post (1.16.5) hahaha
I'm currently using anvil guis for most user input stuff cause it allows the input message to be pretty long
I KNOW THAT PERSON LMAO
can you explain please?! This was my idea yesterday but I could not find anything that explained
I'm using that and it works like a charme
np, have fun with it
does somebody know I want to place how can I place a block when a beacon is placed I want to place blocks on it how can I do that
you get the PlaceBlockEvent and then you can set a block with a Location.getBlock().setType(Material.TYPE)
you know how?
getLocation and offset
Example?
just do
new Location(event.getWorld(), X, Y, Z).getBlock()
yes but I want the location on it
event.getBlock().getLocation()
Block block = event.getBlock();
if (block.getType() == Material.BEACON) {
block.getRelative(BlockFace.UP).setType(Material.STONE);```
^
ok
and also can you tell me how can I place at the sides
of the beacon
change the BlockFace
same as above, use NORTH etc for the BlockFace
ok
You can use i guess: NORTH, SOUTH, EAST, WEST, DOWN, UP
there is also NORTHEAST etc
I want Down, East, West, North, South is it possible
really? So the block on the corners?
yes
ok
Are there any local variables for players besides HashMap and Statistic?
?
Global variable, separate for each player
i have no clue what you mean
client-side packets, what's the burden between when receiving a changed itemstack and moving an armorstand. Which would it cause more lag?
Hello guys can someone explain what the f is skript
Is there any reason why this code would take 2 every second and not 1? https://www.toptal.com/developers/hastebin/edelimagig.java
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
there sevrer is running at 20tps
ur runnable might be too performance heavy to execute in 1 sec intervals
wait
i read tha twrong
terrible
i dont really get it mind elaborating?
mc development for those who are too weak for java
I know and the Turk minecraft players always uses it
Its technically a custom scripting language that you can use. Its yet another layer over the spigot API so has some major performance issues
So its a timer on a scoreboard, the timer duration is the int variable. The runnable takes 1 away from the duration variable every second, but its currently taking 2 every second
Its shitty but can you do anything with it as spigot
as far as i can tell, you can do most things that you can do with pure spigot but not everything
its still shit lmao
maybe ur not giving the scoreboard enough time to update? change the interval in which your runnable is being called and see if it behaves properly
make it a big longer like 40 and see if it behaves properly
its true
package dev.jamieisgeek.parkourtag.Utils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
import static dev.jamieisgeek.parkourtag.Utils.PTUtils.*;
public class GameInProgress {
public static void GameInProgress() {
final int[] startTimer = {6};
new BukkitRunnable() {
@Override
public void run() {
startTimer[0] = startTimer[0] - 1;
joinedPlayers.forEach((UUID id) -> {
Player p = Bukkit.getPlayer(id);
p.sendMessage(prefix + ChatColor.WHITE + "Game starts in: " + startTimer[0]);
if(startTimer[0] == 1) {
p.sendMessage(prefix + "Run!");
this.cancel();
inProgress = true;
ScoreUpdate.updateScoreboard();
}
});
}
}.runTaskTimer(main, 0, 20);
}
}
wait
i think i've seen the problem
its inside the forEach
what if I compile the plug-in in a more-recent version of java?
A plain Material[] array ?
If I do that it gives me an error saying
Provided: Material[]```
share your code
ok
This is where it gives error:
block.getRelative(BlockFace.UP).setType(colors);```
Well that is a) not how you define an array
and b), a block can only have one type
not all of them at the same time
oh so how can I change blocks after 1 seconds in a location
not really no
hi! how can i render particles at the border of a boundingbox?
ty a
Caused by: java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to class java.util.Map (org.bukkit.configuration.MemorySection is in unnamed module of loader 'app'; java.util.Map is in module java.base of loader 'bootstrap')```
does anyone know what is the problem here?
i guess the shortest way is
Bukkit.getScheduler().runTaskLater(plugin, () -> System.out.println("ran after 20 Ticks"), 20L);
uhh, i don't think you want to cast a memorysection to map...
How to remove Renderers from unloaded ItemStack of type Map
ItemStack map = new ItemStack(Material.FILLED_MAP);
ItemMeta meta = map.getItemMeta();
meta.setCustomModelData(1);
meta.setDisplayName(CharEntry.QUEST_ITEM + ChatColor.DARK_AQUA+ ChatColor.BOLD+ "Quest" + ChatColor.RESET + CharEntry.TREASURE_ICON);
MapView view = ((MapMeta)meta).getMapView();
view.getRenderers().forEach(view::removeRenderer);
view.addRenderer(new TreasureRenderer());
map.setItemMeta(meta);
this throws null error on the line ```
MapView view = ..
https://i.imgur.com/G48jQPz.png
hiii, how do you think I could do something like that with an Anvil? Do I have to give a kind of custom model to the inventory to associate it with a texture?
Yeah you will need to use a resourcepack to retexture the anvil inventory
If you don't want to retexture the anvil inventory retexture an item to be the size of the inventory
785100 IQ
thanks
Please rate the code, what needs to be fixed?
public HashMap<Player, Integer> map = new HashMap<>();
@EventHandler
public void PlayerToggleSneakEvent(PlayerToggleSneakEvent e){
if(e.isSneaking()){
int value = map.get(e.getPlayer());
map.replace(e.getPlayer(), value + 1);
Bukkit.getScheduler().scheduleSyncDelayedTask(ParkourV1.instance, () -> {
map.replace(e.getPlayer(),0);
},5);
}
}
@EventHandler
public void OnPlayerMove(PlayerMoveEvent e){
if((int)map.get(e.getPlayer()) == 2 && e.getPlayer().isOnGround()){
map.replace(e.getPlayer(),0);
double diffX = e.getTo().getX() - e.getFrom().getX();
double diffY = e.getTo().getY() - e.getFrom().getY();
double diffZ = e.getTo().getZ() - e.getFrom().getZ();
e.getPlayer().setVelocity(new Vector(diffX, diffY, diffZ).multiply(10));
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event){
map.put(event.getPlayer(), 0);
}
Does this code have a big performance impact?
your naming is weird
ye
but also you should reuse variables
^^
sendTitle with int for fade in, stay and fade out
Should I use display name?
uuid
There are two sendTitle
it says they're deprecated both of them
Are you using PaperAPI
no
purpur?
spigot
How can I get UUID?
oh wait my ide was just getting braindamage nevermind
p.getUUID
player#getUniqueId
Thanks
np happens
aight peace out yall study aight? be top imma go back to coding my game thanks for help
dont need to cast map.get(player) to an int
also map.replace is kind of a weird way of doing it, map.put should probably be used instead
Thanks
And what about performance?
I highly doubt you want to change the velocity of the player when they move their mouse
Keep in mind PlayerMoveEvent is called when players look around as well
Then what event can I use to have velocity or from, to in it?
good morning
package me.armando_sales.ultimate_protection.events;
import org.bukkit.block.Block;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.Player;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class Protection implements ConfigurationSerializable {
@Override
@Nonnull
public Map<String, Object> serialize() {
Map<String, Object> stringObjectMap = new HashMap<>();
stringObjectMap.put(this.toString(), this);
return stringObjectMap;
}
private final Player owner;
private final Block block;
private final Set<Player> players = new HashSet<>();
@Override
public String toString() {
return "Protection{" +
"owner=" + owner.getName() +
", block=" + block.getType() +
", players=" + players +
'}';
}
public Protection(Player owner, Block block) {
this.owner = owner;
this.block = block;
}
public Player getOwner() {
return owner;
}
public Block getBlock() {
return block;
}
public Set<Player> getPlayers() {
return players;
}
}
can you tell me what does mean these &id and *id?
c8c93dab-ee5f-2f90-9aae-82abcfd00a6c:
- &id002
==: me.armando_sales.ultimate_protection.events.Protection
Protection{owner=ArmandoSales, block=CHEST, players=[]}: *id002
- &id003
==: me.armando_sales.ultimate_protection.events.Protection
Protection{owner=ArmandoSales, block=CHEST, players=[]}: *id003
Didn't I tell you this yesterday? Put your dodge logic directly in the sneak listener
What are you trying to do exactly
Also make sure to remove player from your map when they leave the game or you’re going to have a memory leak
I want to track player movement
What do you want to track it for?
#help-development message
so, everytime I place a chest the Id is incremented, is there a way to reset it or
is there a way to remove them?
It's not work, because ween I try to track velocity, this velocity is 0
Are you trying to store the serializable objects in a string list
yes
Can’t tell on mobile but that’s what it looks like
Which event should i use to track ween player leave from server?
The ID is probably just something Bukkit does when you serialized as string
¯_(ツ)_/¯
I’ve only seen ConfigurationSerializables being used as like configuration sections, never seen them stored as string lists
PlayerQuitEvent
Thanks
that is ok thx
idk why its not working, even tough i didnt had any problem with it before:
Caused by: java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to class java.util.Map (org.bukkit.configuration.MemorySection is in unnamed module of loader 'app'; java.util.Map is in module java.base of loader 'bootstrap')<- the error.
public static void givePlayerKitWithCustomSort(Player playerName, Kit kit) {
playersHaveKit.add(playerName.getName());
Map<Integer, Object> map = (Map<Integer, Object>) Main.yamlConfiguration.getValues(true).get("Koasyytank");
if (map == null) {
givePlayerKit(playerName, kit);
}
for (int i = 0; i < kit.getKitSize(); i++) {
if (map.get(i) == Material.AIR) {
continue;
}
playerName.getInventory().setItem(i, ItemStack.deserialize((Map<String, Object>) map.get(Integer.toString(i))));
}
Bukkit.getPlayer("playerName").getInventory().setBoots(kit.getKitContain(37));
Bukkit.getPlayer("playerName").getInventory().setLeggings(kit.getKitContain(38));
Bukkit.getPlayer("playerName").getInventory().setChestplate(kit.getKitContain(39));
Bukkit.getPlayer("playerName").getInventory().setHelmet(kit.getKitContain(40));
}``` my method where its saying where the error is getting from
How to move a whole bunch of blocks repeatedly at once in same direction?
⭐ loop ⭐
And how to load a large build ?
If its possible without APIs
can i provide a book to be opened till the last papaer
like. place a ton of blocks?
yep
My idea is to load a ship that will be controllable when player joins
I tried using fixed for loops for generating Sails
but that seemed little too awkward for me
could use this
thx imma take a look at it
is there any way can not click done buton till get the last paper on a book
Would this be correct?
Bukkit.getServer().getWorld("main")).playSound(player.getLocation(), Plugin.getPluginInstance().getConfig().getObject("Sound", Sound.class), 0.5f, 0f);
In the Config:
Sound: BLOCK_NOTE_BLOCK_HARP
You'd be better off using #getString("Sound") instead of #getObject("Sound") as you wouldn't need to cast to a string.
Also, if you have the player object, you can use player#getWorld() instead of Bukkit#getWorld()
It does.
if some idiot deletes it, it will throw an exception
Oh alright, perfect thanks ^:)
ik
dont do it then
if(player.hasPermission("Fancychats." + plugin.getConfig().getStringList("Colors")))
I want to print this line
How do I do it
I want to print the full form of this permission
hello guys there is a problem
why are you checking if a player has a permission of a list to a string?
Anyone here good with mysql? I'm having some small issues with my setup. I've got my queries working, but they seem slow. They are tied to inventory click actions, and they do work, but it takes a second. I'm worried about what would happen if multiple people were using the inventories at the same time. Is this normal for mysql? Is there a way to speed things up?
when i join a server i cant fucking see anything just air
- "&c"
- "&f"
- "&e"
- "&8"
- "&7"```
Config.yml
are you querying your db every time?
If player has perms like FancyChats.&c
it will change its font color to red
and so on
idk what I'm doing, but I'm doing something ig.
I believe so. Everytime my interface calls a method, it executes a query.
Which unfortunately, needs to be often.
that will check if player.hasPermission("FancyChats.["&c", "&f", /* etc */]")
oh
you're better off using some kind of cache, to not do heavy database operations all the time
and query your db once in a while
then what can I do?
what are you tryin to achieve?
checking if the player has permisison to use that colorcode in chat?
I'm trying to achieve the permission the player has, for example if player has perms like Fancychat.&c, the chat he sends will be changed to red color if has .&e will change to yellow color etc
Hmm, well I am a little worried about how much data I have per player, but I am caching yaml files for the other storage implementation. My only question is how would I save these queries to be executed later if I'm storing playerdata in a cache?
i guess you want to loop over the color codes and if the player has that permission, break and apply it
so i assume these codes are in some specific order
No, color codes are written randomly in the config
i dont think you want to cache queries but rather have some methods that interact with your database and call them once in a while
so like saving the whole cache after some time
String msg = event.getMessage(); String newMsg = ChatColor.translateAlternateColorCodes('&', "" + msg); event.getMessage().replace(msg,newMsg);
I'm trying something like this
'&',""+ msg
idk what to put inside this
so that it works
;-;
I'm myself confused.
event.getMessage().replace(msg,newMsg); makes no sense
strings are immutable
event.setMessage exists
for (String colorCode : config.getStringList("codes")) {
if (player.hasPermission("blablabla." + colorCode)) {
// save that code for the player somewhere idk
break; //???
}
}```
Yea, that would be ideal. My interface is actually set up to do this. It's just that I don't know what the best approach to that would be. Unlike yaml, I would have to write the getter methods from scratch.
not sure about the break part but you cant have multiple colors applied i guess
Wouldn't I also need a PlayerDataObject of some sorts to keep track of all player stats and settings?
im making it so you can edit and add lines from it config
but how i make it color it as the config
i would do that ye or some Map<UUID, Playerdata>
i tried java Objective obj = scoreboard.registerNewObjective("server", "dummy", ChatColor.translateAlternateColorCodes("&", plugin.getConfig().getString("ScoreBoard_name"))); but it says error
Oh, I guess one implementation could be to make that playerdata object, and when it calls the save() method, rewrite the entire player data in the database.
if i try ChatColor.BLUE it works
or any other color
but not translateAlternateColorCodes
i was doing my cache like this @kind hatch https://github.com/FourteenBrush/MagmaBuildNetworkReloaded/blob/master/src/main/java/me/fourteendoggo/MagmaBuildNetworkReloaded/storage/RemoteDataCache.java
not optimized at all but it might give you an idea
if (player.hasPermission("Fancychats." + colorCode)) { String msg = event.getMessage(); String newMsg = ChatColor.translateAlternateColorCodes('&', colorCode + msg); event.setMessage(newMsg); break;
does this make sense
?
dont think you want to check if the player has permission every time
rather save the color code or something
so the actual ChatColor, not the char
is there an event for entity move?
like there is playermoveevent
but is there also entitymoveevent?
or smth similar
I'm not sure, how I can do it..
in the paper api there is
in spigot?
Hmm, I'm doing something similar in my yaml data manager class. https://gitlab.com/Nothixal/hugs/-/blob/master/core/src/main/java/me/nothixal/hugs/managers/data/types/yaml/YAMLPlayerDataManager.java
I guess I'll just have to play around a little with a custom data object and see how I can adapt it.
Maybe you should return instead of break
have some Map<UUID, ChatColor> maybe that stores the color code that the player is currently using
Is it possible to split the username of players with a space ?
can you ppl just tell me how can I make that whenever I place a beacon it places a block on it and after 1 it changes the block on it I cant understand anything
?scheduling
and listen for the blockplaceevent
it doesnt have what I wanted
It is only reading the first string,
- "&c"
- "&f"```
Even if the player has permission of ``Fancychat.&e`` the chat color will be red.
after 1 hit?
ik but I want it to also change it after one second
no
but I want it continiously and
and it repeat on changing blocks on it
then schedule a reapeating task
We've spoon fed you enough code already
If you want us to write the entire thing for you why not hire someone
?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/
i guess the beacon color will change when you place a block on it serversided 🤤
my code looks liek this rn:
int c_color = 0;
public void run() {
if (c_color==7){
c_color=0;
}
block.getRelative(BlockFace.UP).setType(Material.RED_STAINED_GLASS);
c_color++;
if (c_color == 1){
block.getRelative(BlockFace.UP).setType(Material.ORANGE_STAINED_GLASS);
c_color++;
}
if (c_color==2){
block.getRelative(BlockFace.UP).setType(Material.YELLOW_STAINED_GLASS);
c_color++;
}
if (c_color==3){
block.getRelative(BlockFace.UP).setType(Material.YELLOW_STAINED_GLASS);
c_color++;
}
if (c_color==4){
block.getRelative(BlockFace.UP).setType(Material.GREEN_STAINED_GLASS);
c_color++;
}
if (c_color==5){
block.getRelative(BlockFace.UP).setType(Material.BLUE_STAINED_GLASS);
c_color++;
}
if (c_color==6){
block.getRelative(BlockFace.UP).setType(Material.PURPLE_STAINED_GLASS);
}
}
}.runTaskTimer(plugin, 20, 20);
}
}```
use a switch
me?
Yes
ye
ok
placing a different (glass block i guess) on a beacon whenever its placed
I am trying yo change the block on the beacon after every one second reptivley
ye
and whats 'after 1'?
after 1 second
i love that resource 😍
i'd say hide them all and the ones you dont want to hide, write their description in the lore?
didnt i make fun of this conditioning a few days ago? my friend, just some tip look up switch statements. it runs so much faster than this if you plan to use constant values
"spread - Spread of the arrow. A recommend spread is 12"
what do they mean with spread?
angle deviation
setting it to 0 will make the arrow follow the direction vector perfectly
adding it will be a spread% innacuracy
same
where is the wiki for saying what packet contains what?
i rmb there was something like this on a minecraft wiki
found it
and i can actually use it for my plugin
player runnable things
😬
only gets worse
Ahh got it, thanks
Is there a way to add a visual trail to the arrow?
spawn particles
why isnt spigot using the official mojang mappings for NMS classes?
Wouldn't I have to do that in a runnable?
I'll try it
Is there something less intensive than
for(World w : Bukkit.getWorlds()) {
for(Entity ent : w.getEntities()) {
if(ent instanceof Arrow) {
Arrow a = (Arrow) ent;
if(a.getPersistentDataContainer().get(plugin.key, PersistentDataType.STRING).equals("spartanian arrow with target " + player.getUniqueID()))
a.remove();
}
}
}```to remove all specific arrows?
hi, please tell me what kind of event happens when a player deals damage to someone?
You can use Mojmaps if you want
Or which event should I track instead of EntityDamageByEntityEvent
^
then... tell me if I can damage the entity so that this event does not work, but so that the affected entity knows who caused the damage
but how can i remap my plugin after using them?
Scroll down to developer notes
?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/
In general, I wrote a script that deals 10 units of damage to all players within a radius of 5 blocks when a key is pressed. However, I also have another script that overrides the damage of players from EntityDamageByEntityEvent like this: damage*attackCooldown^2.
As a result, it turns out like this - an event is triggered, the delay from the attack is reset and the next target within a radius of 5 blocks does not receive damage
Tell me in which direction I should look for an error so that there is no conflict
@tardy delta it doesnt work its not placing a block on it
Hey, can someone help me with my code please?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
https://www.toptal.com/developers/hastebin/bugoputapa.csharp Here is my code
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
is it possible to make that when player getrightclicked he can accept or deny
How can I silence a living entity?
Wdym by silence?
So it won't make a sound, like the sound a Villager does
Well that's one way of doing that😅
get the entity and tell her that the damager tried to hurt her, also cancel the event
If the #setSilent() method is available for all entities, then you could use that. Otherwise, you may have to modify the entity tags some other way.
That flag hides all enchants no matter what. You would need a custom enchant solution/lore management system.
In protocollib, is there a way to get the field name?
cause the order of protocollib is not the same as in the wiki
anyone knows why my default config doesn't reset when I delete everything from it, save it and then reload?
