#help-development
1 messages · Page 1707 of 1
and i cannot access the interface
let me also implement api
still now working
not working
@EventHandler
public void enderpearlThrow(ProjectileLaunchEvent event) {
if (!event.getEntity().getType().equals(EntityType.ENDER_PEARL)) return;
if (!(event.getEntity().getShooter() instanceof Player)) return;
EnderPearl enderPearl = (EnderPearl) event.getEntity();
ItemStack enderPearlItem = enderPearl.getItem();
ItemMeta enderPearlItemItemMeta = enderPearlItem.getItemMeta();
Player shooter = (Player) event.getEntity().getShooter();
enderPearlItemItemMeta.setDisplayName("haha");
enderPearlItem.setItemMeta(enderPearlItemItemMeta);
enderPearl.setItem(enderPearlItem);
}
yea
okay i may found a way to do it
i done package things and it got fixed
@ivory sleet i have another problem
im trying to access a class from core
or plugin
in my versions
and i cant implement the core cause i cant
it wont compile if i do it
what should i do ?
uh guys kinda need help again lol
Bukkit.getScheduler().scheduleSyncRepeatingTask(Testing.getPlugin(Testing.class), () -> {
Bukkit.broadcastMessage("This message is shown immediately and then repeated every second.");
}, 0L, 20L);
``` what do i need to change at the Bukkit.broadcastMessage to make it repeat my scoreboard?
this
i need to scoreboard to repeat
yeh
and?
example code pls?
how to set player xp
my laptop battery about to die but i dont have a place to charge here.. sad life lol
no im here
net is shit rn
well sure
but the whole thing?
i put the thing and now i press ctrl + s but now?
okay i gg now because my battery gonna die
send it to me in dm ig?
okay ill be back when i charge my laptop lol
anyone knows how can I load something saved like this?:
public static List<RecipeSign> signs = new ArrayList<>();
public void saveSigns(){
this.getConfig().set("signs", signs);
this.saveConfig();
}
public void loadSigns(){
List loadedSigns = this.getConfig().??????; //what should this "???????" be?
signs = loadedSigns;
}
i try thx
it gives me this error: https://hastebin.com/qoderehequ.typescript
you cant just serialise everything you want
you have to either numb it down or make ur own
implement ConfigurationSerializable in your RecipeSign class
implement the methods it requires and register your class
think its a spigot class
its not
ah yes
its his own, and he was told this yesterday or the day before by myself and 7smile7
it made me add this to RecipeSign
public Map<String, Object> serialize() {
return null;
}```
do u have an example on how to use this serialization?
you could always save primitives and later build the object with them..
where you have null you need to parse teh Map and reconstruct your class fields in the constructor
how does one make a new entity in a variable, then set a player's passenger to that variable
Entity armorStand = new Entity(EntityType.ARMOR_STAND, player.getWorld());
idk how to work with entites
for serializing you build a map
World#spawnEntity
hmmm ok
i don't want to spawn one, i want to set it to a variable and then set the passanger of the player to it
if it's not spawned, you can't modify the passenger
alright
thanks
np
ok i got this:
Entity armorStand = player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
how do i put a paper with a custom model data of 1 on their head
How do i use CraftMagicNumbers or any other tool to calculate the amount of drops from an fortune tool
change the type of the entity to ArmorStand
replace Entity with ArmorStand
and call .setHelmet(item) on it
I'm kinda new to Spigot so I dont know how to put an damaged item onto it
oh ok thx
Can anyone help me with this?
I know what method to call but i cannot seem to import it
how do i add the helmet slot thing doe
declaration: package: org.bukkit.entity, interface: ArmorStand
deprecated
alr
declaration: package: org.bukkit.entity, interface: LivingEntity
ty
np
But how do i get the amount of items dropped from an block using a fortune pickaxe
you can;t get the loot until its actually broken, due to the random reward
btw can anyone help with this?
I want to get the amount of items dropped on the BlockBreak event
BlockDropItemEvent
clear the drops
or remove any items you don;t want to drop
eg, this would double the drops ```java
@EventHandler
public void onDropItem(BlockDropItemEvent event) {
for(Item item: event.getItems()) {
ItemStack drop = item.getItemStack();
drop.setAmount(drop.getAmount() * 2);
}
}```
alr
but can i cancel the dropping as a whole using BlockDropItemEvent.setCancelled(true) ?
Use the javadoc for simple to answer questions https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html
alright, thanks!
Is there a way to execute a command from a plugin without logging the command to the console?
declaration: package: org.bukkit, class: Bukkit
Omg Thank you so much!
Logs are noisy when using dispatch commands
Get the command then from the command map and invoke it?
Or maybe if the Server instance offers a way to get a command by its name
Location
kk ty
Bukkit.getScoreboardManager().getMainScoreboard() If I set anything to this scoreboard, will it be visible to all players?
Ok it saves it to the world, don't want this
How do i cast an List of Item to ItemStack[]
toArray()?
You don’t
oh you mean a List<Item>
yeah
yea you dont
What i'm trying to do is put the Drops from an BlockItemDrop event directly into the player's inventory
BlockDropItem*
Is there a way to do this?
BlockItemDropEvent.getItems() returns an List<Item>, i can iterate trough that array but PlayerInventory.addItem() needs an ItemStack
item.getItemStack
I need to store a players location in a pdc, how would I do this
hm
is there a location persistentdatatype ?
no
if there was I would be here 🤦♂️
why do you need a location in a PDC?
You'd have to use multiple containers or the String type
you can store locationWorld string
You can always implement a custom pdc type 😄
locationX double
yea just use custom pdc
because I need to store someone's location through restarts
?paste
like, when they execute a command, I need to get their location, and store it in a pdc
if they execute a command they are online and have a location object
Player#getLocation()
I know
^
use this
and create a location
persistentdatatype
I need to store the player's location when they execute a command
Is there a way to cancel the dropping of the items on an EntityDeathEvent?
Do i just set the amount to 0
?
yes
e.getDrops().clear()
so can anybody tell me how to change jdk version of a gradle module
and not the others in the project ?
SDK is 16
but when i compile it
i have different modules
on for 1.8, 1.9.4 and...
all can compile with java 8
but 1.17 need java 16
I'm guessing this wouldn't work lol java (JavaPlugin) Main.getPlugin()
ahhhh
@eternal oxide Thanks for the Location pdt class, it really helps!
ok this is a really weird question but has anyone here ever written code for entities or blocks that get modified frequently that would make them auditable?
can someone help me with this ?
?pdc if there is an admin online u can delete this lol
because he's deeply embarrassed for not having memorized that api
I still remember the day I was born god uploaded the documentation for that api directly into my brain
which was not very useful as I would not learn english before I was 7
and java before I was 22
it took months to get it added as a bot command.
bruh
i said the message that is in the channel
cause he thinks this is not the right channel to execute the command
That makes no sense. this is the correct channel for a PDC resource
he said the mods can delete this message
this output of the bot command
You are making even less sense than he is

bruh, dood
?pdc
this is the output
yes
so he thinks this is not the right channel
Indeed
a link
or the command that he executed
the message of it
shouldnt be in this channel
so he said
I think 10% of my braincells died reading this discussion
of course it should
bruh
unless I'm not in #help-development anymore
@ivory sleet can you help me with this ?
What’s the point of this discussion?
I have no idea
1.17 does not need java 16 to compile
the nms
He's calling me bruh as if I should be understanding something
Seems so you had plenty of opportunity to explain but bruh wasn't too helpful
so can you help ?
i want my 1.17 module
to use java 16
the sdk of the module is set to 16
but this happens
And language level?
?paste
and 7.1.1
I know its something to do with something being null, but big reveal I was trying to make a simple home and sethome command. help. https://paste.md-5.net/waxoqitudo.coffeescript
man kids these days have it easy
your command is missing from your plugin.yml
or misspelled
the java I know doesn't even tell me what is null
Okay well what if you set every module to Java 8 except the 1.17.1 nms module?
i done it
conclure smells
and language level is 8
LifeSteal.java line 22
the project
ik
How have you done it?
from here
they were tabbed wrong 🤦♂️
I believe you should quite literally set it using something like targetCompatibility = sourceCompatibility = JavaVersion.VERSION in every module might be best
If it’s the groovy dsl
it is
so you mean
the build.gradle of every module
Yes precisely
what is for 16 ?
16
Yaa
right ?
Well
You’d want to use 8 for most ones
Only 16 for the ones which need 16 if I remember correctly
what about my api module and my plugin module ?
the version of java
8 ?
8
now all of my commands are tabbed and spelled correctly, and I'm still getting the same error
?paste
?paste your plugin.yml
@ivory sleet this error
and what is line 22 that is throwing the error?
now its 23, both commands. I will just paste all my commands java this.getCommand("heal").setExecutor(new Heal()); this.getCommand("sethome").setExecutor(new SetHome()); this.getCommand("home").setExecutor(new Home());
line 10 in your plugin.yml
permission: default:op
yep
wut
Hmm this is odd
it was working before I added home and sethome
default: op```
wut permission do I put in permission.here?
Okay maybe try java 16 there
whatever permission you want for the command
I need to check something
I want op
no a permission not a level
if i wanted to make my whole project 16 or 8 i didnt used modules
what permission then, I have no custom perms
this is where you create it
oooh
like lifesteal.command.heal
so what should i do
go to File -> Settings -> Build Execution Development -> Compiler -> Java Compiler
set the project bytecode to java 8 but then add ur 1.17 module and set that per project bytecode to java 16
either sethome is doing absolutely nothing, or home isn't checking properly java if (player.getPersistentDataContainer().has(key, locPDT))
all of them are 16
im just going to ignore what you just sent ok thx
mute him for 1 min please
Conclure is my dad
anyone got an issue?
@ivory sleet
C:\Users\pmzjs\Desktop\TrexMine\TrexHolograms\versions\v1_17_R1\src\main\java\com\trexmine\trexholograms\v1_17_R1\HologramManager.java:5: error: cannot access net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
^
bad class file: C:\Users\pmzjs\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT.jar(net/minecraft/network/protocol/game/PacketPlayOutEntityMetadata.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
This is #help-development sir
the same error
^^^
breh
shoot sorry.. ill talk it to your dms 😉
Due to unfortunate reasons this server hereby does not possess commands of muting people.
dyno exists you know
!mute
you dont have perm
I'm pretty sure dyno uses slash commands lol
dyno is like that
if you dont have perm, no output
:[
we need someone to mute him
any ideas ?
Dyno is slow at counting
yes
not enough fingers and toes
elgarl you’re english rite
yep
opinions on the fuel shortage?
lol
Stupid people listening to the news media causing a panic
maybe check this out, https://www.spigotmc.org/threads/extreme-abstraction-for-using-nms.521677/
yes a spigot thread
yeah, but in a couple of days they will all have full tanks and garages will have caught up
ig - just hope that people don’t pay attention to the news talking about food shortages as well 
i have done it
yeah this is odd
and now
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
> Could not resolve project :versions:v1_17_R1.
Required by:
project : > project :Core
> No matching variant of project :versions:v1_17_R1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'apiElements' capability com.trexmine:v1_17_R1:1.0-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 16 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'runtimeElements' capability com.trexmine:v1_17_R1:1.0-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
oh
maybe
use compileOnly instead of implementation for api and for every nms module
only use implementation in the main/rootproject build.gradle
havent thought about that
but might be substantial since implementation inevitably adds the dependency both as a compile time and a runtime one
same error
Hello, why when i type this command in the console, it sends an error?
https://paste.md-5.net/uqotetovev.java
PmzHero can u push to gh?
learn about variable scope
when i send it in mc in works
ok
of course you are casting to Plyer before you test it is a player
and
and no I wont steal your code
Console is not a player
but nothing
system.out
yes
sends to console
i want that
@ivory sleet what is your github username ?
you have nothing happening at all if there are args
Conclure
oh
you know I am having fun when I have to add a way to audit entities to know wtf they've been doing
@ivory sleet i added you accept
lol
link
yoink I have now stolen your code
private repo lmao
?ban @quaint mantle good bye
Done. That felt good.
thats not the right one?
lmk if you ever find a way to filter those nitro scams
if i want to store data on a player like stats (custom level, things like that) would persistentdatacontainer be a good way?
lmk if you ever find a way also lol
I'll link you to my premium solution, only $300
and also how could i implement data fetching from that player when the player is offline?
^
damn, sounds like an established investment
why
where r the modules?
it is
I'm memeing but I bet there's servers out there that would pay double that to solve this
thats a really hard problem to solve tho
why is it empty
I'm considering just blacklisting the word nitro
there will always be ways to share these scams
let me setup git and push it
totally worth paying $300 for
yeah
Ways to store data for players
I am using BlockPlaceEvent to stop the player from placing a specific block though the block i want the player to not be able to place is a custom item that i made and i want to check the display name to see if it is that custom item the player is trying to place, how would i do this?
compare their date of birth
i use persistendatacontainers on items to store custom properties such as a custom item id so that i can detect whether its vanilla or custom
elgar has the right solution
you are responding to me?
yes
What's the alternative to Player#getItemInHand() because it says it's deprecated
what exactly do you mean
quick q before I have to dip, how are data containers queried? map?
use myCustomItem.isSimilar(event.getItem)
Player.Inventory.getItemInMainHand()
okay thank you
or offhand
event.getitem isnt there
i am using BlockPlaceEvent
are data containers using maps behind the scenes or something else?
Ok
Oh and another thing how can I find in which slot the item is smth like ItemStack#getSlot()
but wouldnt that return the item that the player has in their hand after they placed the block
it oculd be air or the block that the player just placed in case they have a stack of them
Before, as its a cancellable event
Im making a ridable snowball thingy, my only issue is the snowball colides with the player whilst they are riding it. anyone know any ways of preventing this?
@ivory sleet i made a new repo and added you
https://github.com/PmzHeroV69/imhavingahardtimewithmultimodule
@quaint mantle
remove
compileOnly files('C:/Users/pmzjs/.m2/repository/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.jar')
compileOnly files('C:/Users/pmzjs/.m2/repository/org/spigotmc/spigot/1.9.4-R0.1-SNAPSHOT/spigot-1.9.4-R0.1-SNAPSHOT.jar')
compileOnly files('C:/Users/pmzjs/.m2/repository/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.jar')
compileOnly files('C:/Users/pmzjs/.m2/repository/org/spigotmc/spigot/1.16.5-R0.1-SNAPSHOT/spigot-1.16.5-R0.1-SNAPSHOT.jar')
compileOnly files('C:/Users/pmzjs/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.jar')
?
in COre
yes
ok
in multiversion also
I am using this code: compactTNTRecipe.addIngredient(567, Material.TNT); : And the error i get is: Shapeless recipes cannot have more than 9 ingredients : Anybody got a solution as i am trying to make a recipe that requires a stack of tnt in every slot.
@quaint mantle for the sake of god
use compileOnly 'org.spigotmc
version' instead
Could not determine the dependencies of task ':Core:compileJava'.
> Could not resolve all task dependencies for configuration ':Core:compileClasspath'.
> Could not resolve project :versions:v1_17_R1.
Required by:
project :Core
> No matching variant of project :versions:v1_17_R1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'apiElements' capability com.trexmine:v1_17_R1:1.0-SNAPSHOT declares an API of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'runtimeElements' capability com.trexmine:v1_17_R1:1.0-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
i changed multiversion
and
core
i pushed the new changes
now in every nms module
do tis
?paste
Could anybody help me with this error? https://paste.md-5.net/elotepazut.nginx
You will need to use the crafting events for this
Your namespace key is invalid, no caps
I am using NameSpacedkey.minecraft("e")
thats what i saw in the tutorial
i dont fully understand it but it worked for him
Oh
I changed ti to this
before it was adding 576 tnt at once
now i made it add 64 9 times
and i dont get that error anymore
@ivory sleet same error
yeah pmz btw is :versions a module?
i guess
Ok the crafting is the problem now
i will try a crating event
hey, I have an really huge calculation task to perform so how can I run it in another thread with spigot?
I just use an bukkit runnable?
everything is bugged now
yeah
k
I am trying to make a recipe with a stack of tnt in each slot but i keep getting the error: Shapeless recipes cannot have more than 9 ingredients : Is there anyway to get around this?
rootProject.name = 'TrexHolograms'
include ':versions/multiversion'
findProject(':versions/multiversion')?.name = 'multiversion'
include ':core'
findProject(':core')?.name = 'core'
include ':versions/v1_8_R3'
findProject(':versions/v1_8_R3')?.name = 'v1_8_R3'
include ':versions/v1_9_R2'
findProject(':versions:/1_9_R2')?.name = 'v1_9_R2'
include ':versions/v1_12_R1'
findProject(':versions/v1_12_R1')?.name = 'v1_12_R1'
include ':versions/v1_16_R3'
findProject(':versions/v1_16_R3')?.name = 'v1_16_R3'
include ':versions/v1_17_R1'
findProject(':versions/v1_17_R1')?.name = 'v1_17_R1'
@quaint mantle
then
when adding
use project(':versions/name') of the module is contained in versions
?paste
does anyone know why Byte storage is not more widely used in plugins?
@ivory sleet https://paste.md-5.net/wanapimiqu.cs
name ur Core core
@ivory sleet https://paste.md-5.net/uyupufegiy.cs
wait
alr
@ivory sleet done
rename ur module Core to core
including the directory
as said several times now
use kebab-case for module naming
seems to be Core on gh still
Git doesn't care much about capitalization
sadly
ya should still work
oh
the problem is not related to core module name
A problem occurred evaluating project ':core'.
Project with path ':versions/v1_12_R1' could not be found in project ':core'.
well
you renamed ur module to just v1_12_R1
so skip versions/
oh yeah I told u to use that earlier didnt I, im a dofus lol
A problem occurred evaluating project ':core'.
Project with path ':v1_9_R2' could not be found in project ':core'.
without : maybe
A problem occurred evaluating project ':core'.
Project with path 'v1_9_R2' could not be found in project ':core'.
let me change it to : in settings
and retry
yeah
I'm a bit rust when it comes to subprojects, havent had the need to mess with that for a while
how can I shedule a function to run in 5 seconds without using Thread.sleep() and freezing the whole game?
?scheduling
Could not resolve project :versions:v1_17_R1.
Required by:
project :core
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
i changed it
alr cool
though if I can suggest something
Maybe let me try fixing it for you?
@quaint mantle
yes if you can
Thanks its just what I was looking for!
I get this error: Cannot have null choice: on this line : explosionRecipe.setIngredient('C', CompactTNT.compactTNT); : This is my custom item and i am confused why i am getting this error
Seems like the variable isn't initialized at that point
Static is an amazing concept for state management
🙃
What exactly do you mean
I have a method that sets the item properties and it is called in the onEnable method
So it shouldnt be null
Before or after you register the ingredients
is there a way i can create a message where you can click on but you can only click on a part of the message (now the clickable part is from some point to the end and i dunno how to fix it)
?paste
smh
?paste
Before
Well either that is wrong or you aren't setting that field correctly
Ill send code
?paste
oh um
i accidentally commented out
the part where it actually sets the item
in the method
lol
now my problem is to place blocks in an async task
I have like 160 blocks to place in 160 chunks
You don't place blocks off the main thread
I know but what can I do?
Well run logic back on the main thread by scheduling a runnable/task
like shedule an task in a task?
mmm or just use a lambda
I am having trouble making a recipe that gives my custom item when there is 9 stacks of tnt in the crafting area, I first got the error Shapeless recipe can only have 9 ingredients or something and now i am having the error Index 9 out of bounds for length 9 Could anybody help me?
@crude hound do you need to place alot of blocks?
an task
one per chunk in a 40 * 40 chunks area
thats not too bad, a runnable should be fine yea
show us then
How can i do that people can use %player% in config?
String.replace("%player%", player.getName());
@quaint mantle I fixed it now
If I join the server for the first time (after resetting the world) I always get teleported to the main world, even if I run this code player.teleport(DogLeader.getLocation(DogLeader.DogLeaderLocation.LOBBY)); (teleport to lobby world), it is not null, because I null check before
@crude hound you should probably just run some tests and Time the results
check how long everything takes
I know that 1/40 of the verifications are made in 1.5 sec with 2 go of ram
well you could consider workload distribution
thanks ❤️
👍
@ivory sleet why is this commented
With Workload distribution bassically your code will only run at the end of everything else. and when the tick ends. it first processes the next tick before continueing with your code
cuz I never ran bt for 1.9
why some stuff are commented
so u can just uncomment it lol
this
yes but if it takes too long to place blocks the players will be kicked
yeah
cuz I cba to run bt 1.9 on the spot
but yeah it ought to be project(':multiversion') btw
with the :
well i dont really know what you need this for. or what you are creating
thanks
like im in a 40 * 40 chunks map and I want to make that
so I maked an long algorithm to make that
and to see if it work I want to place some blocks
to see the state of the chunk
soo you need to have a block in the middle of each chunk?
no where the location that I defined is
for some reason the Utils.isAuthorized... gives an UnsupportedOperationException when trying to tabcomplete
@Override
protected List<String> tabComplete(@NotNull String[] args) {
if (args.length == 1) {
List<String> l = Arrays.asList("set", "remove", "cancel", "help");
if (Utils.isAuthorized(executor, "admin")) l.add("bypass");
return StringUtil.copyPartialMatches(args[0], l, new ArrayList<>());
}
return null;
}
you could add all locations to a list and then iterate trhough the list in a sync bukkit runnable to set the blocks
ho want to do an executor + "admin" or something like that
k
i want to add "bypass" to the tabcomplete options if the user has the admin permission
but the block change from the state decided from my algorithm
then make it a map
k
have Location as key and Material as value
lets use the arrayList constructor 🥺
or Stream.of("a", "b", "c").collect(Collectors.toList()
Lists.newArrayList()
i dont even know why to use that class
it is actually unfortunate that Java does not expose the type of the fixed sized list
is it optimized or something
no but it takes a vararg E and chops it into an arraylist which it returns
so its better than the things i wrote?
so like this?
no worries
@EventHandler
public void onPlayerSpawn(PlayerSpawnLocationEvent e)
{
if(arena.getState() == Arena.ArenaState.WAITING && !arena.getSettings().isPlayable() && DogLeader.getLocation(DogLeader.DogLeaderLocation.LOBBY) != null)
e.setSpawnLocation(DogLeader.getLocation(DogLeader.DogLeaderLocation.LOBBY));
}```
I join at the correct location, but 1 second later I get teleported to world spawn
Note: If I join the server for the second time, it just works
And scoreboard issue: My health is always 0
If I take damage it will be set correctly forever, but it starts with 0
descriptive
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
and pass your plugin instance thru the constructor
I will see
sad
could anyone link me the maven repo for the PagedGUI repo?
How do I set the nametag of a player?
hmm if a player doesnt have permisson to execute a command, is there a tabcomplete?
i gues no
no
oki
Did cancel PlayerTeleportEvent, stupid!
??
the name above their head?
yes
player.setDisplayName(...)
that won't set the tag above their head
basically..
Make a Constructor like
private final Plugin plugin;
public TestCommand(Plugin plugin) {
this.plugin = plugin;
}```
then you can do
```java
this.plugin.getConfig();```
Plugin.getPlugin(Plugin.class).getConfig() 😳
i guess... but i always feel like dependency injection is cleaner especially later on and on more complex things
mwoa yea
good practice 👀
I tried but the server still crash
oh no he's offline
Wait @maiden briar you’re on newdale and I just randomly found you here xD
Cool
I still have a problem with scoreboards: If I add an health objective it does show me 0, and if you take damage it shows the correct health. How is this possible? I tried player.setHealth(player.getHealth() - 0.001); but that does nothing
What packets exactly
Does anybody know a good external API for creating inventorys?
Also updating the scoreboard costs so much tps
found this
PacketPlayOutPlayerInfo with action REMOVE_PLAYER
PacketPlayOutPlayerInfo with action ADD_PLAYER with a different name (perhaps through reflecting on the packet data)
PacketPlayOutDestroyEntity to all players except you.
PacketPlayOutNamedEntitySpawn to all players except you.
its been 10 minutes :/
Thanks sm 😁
i have a nice class for it 😏
could you send it?
?paste
won't this return the home names?
return new HashSet<>(homesFile.getConfigurationSection("homes." + p.getUniqueId()).getKeys(false));
IF is great https://github.com/stefvanschie/IF/
yes
storing data in yaml isnt really a good idea. i think json in general would be better
but its fine ig cause of how bukkit handles things... sadly
i dunno know json good enough
its just one line lmao
i dunno 🥺
anyone knows how to save to a file a list of ItemStack? i tried using gson but i get this error:java.lang.AssertionError: java.lang.NoSuchFieldException: ARMOR
Location loc = gson.fromJson(Files,newBufferedReader(Path.of("C://config.json")), Location.class);
saving ItemStacks to Json is simple. reloading them you will have issues with ItemData
oh
any solution to those issuses? 👀
Bukkit serialization already handles ItemStacks and Location fine
oke i'll re-try with it xd u know any plugin that uses it? I didnt really understand how it works
also to check whether or not a player has a home can i just check return homesFile.isConfigurationSection("homes." + player.getUniqueId();).
yes
better to use .contains though
it may not always be a ConfigurationSection you need to test
ah then i can leave it like i have
but does .contains checks if there are keys under it?
so this is good?
private boolean hasHome(Player p) {
return homesFile.contains("homes." + p.getUniqueId()) &&
homesFile.getConfigurationSection("homes." + p.getUniqueId()).getKeys(false).size() > 0;
}
yea but when i remove a home i get this
if you don;t have anything under that entry it will be null, so getKeys will be operating on a null
getConfigurationSection will probably return null on that
as its not a map
check contains, tells you if it exists
isConfigurationSection tells you if it has a contents map
if both are true getConfigurationSection. getKeys etc
isConfig may already do the contains check but it can;t hurt to do both
oki thank you
is there a way to override worldguard so i can leave horses?
i did this
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityInteract(PlayerInteractEntityEvent event) {
if (event.getRightClicked() instanceof Horse) event.setCancelled(false); // override worldguard
}
hmm its only horses
k
?paste
Change "Plugin" to "p" and remove the ")" beside it
doesnt work
dont worry its already fixed 😄 but thanks anyway
How do you setup buildtools to do NMS stuff on windows?
wut
I need someone to help me fix a few issues and help me progress with my plugin. Dm if you willing to help me.
I wanna write some code using nms but I can't work out how to set it all up.
And how do I add it to my gradle?
same as you do with spgiot, but spigot as the artifact id instead
and with mavenLocal() as ar eoi
a repo
I have mavenLocal() at the top already
Can someone help me with my plugin?
no
no .zip
what .zip
hey guys https://paste.md-5.net/nebokeroje.cs why is it showing the statistic with also the damage dealt but it is not updating
Can someone help me with my plugin?
feel free to ask your question
is it cool if we hop into a call? It would be easier
ask here
cant you just type?
The docs are your gods
declaration: package: org.bukkit.event.block, class: BlockRedstoneEvent
instead of cancelling it you just set the current to 0
well its a custom sharpness enchant
long story short
it worked before
now its not working
just type here its easier for us to understand
no error
when I try to add a different enchantment lvl, its doesnt set it
so yeah
no clue what went wrong
to make it short, just type it man
I just did lmfaoo
What's an event for disabling the Eye of Ender?
when we are areound custom enchant I am looking a way to make custom enchant
check event docs
im pretty sure projectile launch event
?jd
with all features of efficiency
Tried doesn't work
listen to playerinteractevent
.getName ?
doesnt exist
if the interacted block is a button, lever, or they placed redstone current you can send the message
so yeah, thats why I asked to hop into a call so I show it to you, because just looking at the code I dont think you could solve it.
Ill just send screenshots
bump cause yes lol
this is the sharpness
any ideas what went wrong? again, it was working before I added the array list and tried to use that to display a custom enchanting lvl
@quaint mantle can you help me with my customenchant?
i would if i could
wym, you dont know customenchant stuff?
no?
do you have a custom event setup correctly
nah i cant help with that
it probably syncs by itself
idk
try it
blockpistonevent is a base event
listen to PistonExtend instead
ye
i have this
public void setupManager() {
try {
version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
} catch (Exception e) {
getLogger().info("Unable to detect version. plugin disabling");
getServer().getPluginManager().disablePlugin(this);
return;
}
switch (version) {
case "v1_8_R3":
hologramManager = new HologramManager(this);
break;
case "v1_9_R2":
hologramManager = new com.trexmine.trexholograms.v1_9_R2.HologramManager(this);
break;
case "v1_12_R1":
hologramManager = new com.trexmine.trexholograms.v1_12_R1.HologramManager(this);
break;
case "v1_16_R3":
hologramManager = new com.trexmine.trexholograms.v1_16_R3.HologramManager(this);
break;
case "v1_17_R1":
hologramManager = new com.trexmine.trexholograms.v1_17_R1.HologramManager(this);
break;
default:
getLogger().info("Your current version (" + version + ") is not supported!");
getServer().getPluginManager().disablePlugin(this);
return;
}
getLogger().info("Detected version " + version + ". plugin enabling!");
}
but there is a problem when i enable the plugin
https://cdn.discordapp.com/attachments/873960964125503498/891728285619331172/unknown.png
use maven/gradle modules
@Override
public void onEnable() {
Logger logger = Logger.getLogger("MyPlugin");
try {
FileHanler handler = new FileHander(new File(this.getDataFolder(), "pluginlog.log").getPath());
logger.addHandler(handler);
handler.setFormatter(new SimpleFormatter());
}
catch (SecurityException | IOException exception) {
exception.printStackTrace();
this.setEnabled(false);
return;
}
}
@thorn narwhal try this
modified that from a stack overflow post
it seems like this is recognised as an configurationsection too
or getKeys(false).size > 0
either or
make an object of that class?
?scheduling use the scheduler
I'm trying to use java's SerializationUtils but I can't find it, did they change what its called?
maybe this can help, https://stackoverflow.com/questions/7315941/java-lang-illegalthreadstateexception
@quaint mantle ||I apologize in advance, please don't hate me|| You are like the only person who really helps me and no-one is online to help so please.
ye
Well it isn't part of java itself
wut is it then?
tried in 1.12 same thing
What does the link say
Print the version string
classes of what
ok, where do I get this apache API?
let me just remove the default
depend on spigot not spigot-api and you'll have apache commons
are you using maven?
no
then probably
gradle >>>>
so json is faster than yml?
okay i have .java file (source code) for a plugin for some weirdass minecraft jar (the owner is busy with life)
how can i import? it or well, compile and edit, i dont have idea if there is any docs
any idea what i can do?
im using intellij
like, where do i start? i can post the code here...
https://www.spigotmc.org/threads/scoreboard-not-updating-using-the-repeat-task.527372/ i just send this cause i need someone to help :)
still the same problem
how would this look in json?
homes:
9558961c-bc19-4820-9f75-5d486448c2d5:
spawn:
playerName: FourteenBrush
location:
==: org.bukkit.Location
world: Generated World
x: -208.2980065075412
y: 125.0
z: 671.6890372002864
pitch: 21.804726
yaw: 321.21497
zero point is switching from yaml to json
ah found a converter
https://www.spigotmc.org/threads/scoreboard-not-updating-using-the-repeat-task.527372/#post-4271644 need help
can i parse from json to a location object?
I'm making my own PeristantDataType and I wanted my own class to be the complex type, it is forcing me to remove the @Override, is it ok if I do this?
public byte[] toPrimitive(Loc complex, PersistentDataAdapterContext context) {
return SerializationUtils.serialize((complex));
}```
You should not need to remove @override
The method toPrimitive(Loc, PersistentDataAdapterContext) of type PersistentDataType_LOCATION must override or implement a supertype method
Share the class
Loc != Location
Then why does your persistent data type use Location
what's this
java.util.ConcurrentModificationException: null
at java.util.ArrayList.forEach(Unknown Source) ~[?:1.8.0_301]
can anyone help ?
dont really find it
guess I was just being dumb lol
You are trying to remove something from an array while looping it I assume
Home.getBuffer().forEach(home -> home.savePlayerHomes(home.getOwner())); // todo
And what does savePlayerHomes do
Does it try to remove anything from Home.getBuffer
help pls
Try using a normal for each loop and see if the problem is still there
is it posible to add the counter of mined blocks to a menu and unlock things while you reach a amount of blocks?
(don't tell me how, just if it is posible)
Ty 😄
for (Home home : home.getBuffer()) home.savePlayerHomes(home.getOwner());
Yes?
hey coral can you help me?
K ty
Whats up
https://www.spigotmc.org/threads/scoreboard-not-updating-using-the-repeat-task.527372/#post-4271644 it doesnt want to update the task even with the scheduler
Team.addPlayer(player); Try that, but javadoc says it's deprecated
any ideas ??
okie
add that to where?
the main class?
Probably wants a string
Maybe in an onPlayerJoinEvent
