#help-development
1 messages · Page 1502 of 1
So do I make the edit session with fawe and the rest with world edit?
I do have another question I don't know if ya could help at all
Sure
So, I'm trying to load the schematic paste it and then loop all the blocks in the paste area to find certain block types. Any clue on the best way to do this?
Is there no optimized way apart from doing that?
Nope
You could make an algorithm that divide the actual selection in many parts
To have a O(log(n)) complexity on the best case but that's all you could really do
How does one update the icon of a plugin https://i.gyazo.com/7e4b7fda69f9aec48f83649b3f102b4a.png
Edit resource at the bottom of the page and upload a logo
It doesn't do the same things.
contains checks if something is in the list, equals checks if the list contains everything it's checked against.
Differences means that there are some things that are the same ^^'
There isnt a upload a logo option. Save, upload images, and preview... but upload image does not give logo option
Next time, you could also check the actual java doc ^^' it's pretty much explained, or even google it ^^'
@ivory sleet No luck, java.lang.IllegalArgumentException: The embedded resource 'plugins/nationsatwar/capturables/Nations-Config.yml' cannot be found in plugins\nationsatwar-0.0.1-SNAPSHOT-shaded.jar after changing it to toPath()
Again, I am not creating these resources in the code; I am creating these resources externally via the IDE & using maven compile package goals to include them in the jar
Isn't your pom not correct ?
im not sure what you mean by this
Cause here, it seems that it doesn't pack the actual file into the jar
It might be doing that, but thats not a product of the pom
That would be based on my build goals
Which Idk if I am doing them right. Like I said, I am using compile package
Which I thought was what you need to do, but maybe not
Found it "Edit Resource Icon"
Maklegend
Yes
do u have the files in the jar?
I mean, I think so... I am using maven build goals
Could somone take a look at my code?
None of my recipes works now :C
package compile specifically
Well, the stacktrace does seems to say the opposite ^^'
Could you check on your jar ?
How do I check if resources are embedded in the jar?
winrar, decompiler u name it
Maklegend what files do u have in your src/main/resources folder
Let’s see the code
If they aren't there, you need to put a resource directory inside the pom so it will embed these files into the jar
Could somone help me please? o.o
I have my config.yml, plugin.yml,m then a capturables directory with my Nations-Config.yml & Town-Config.yml, which are not being found
I'm not sure what you mean, nor how to do this
Well, if you have your resources in your jar, it's all good
I don't know if i have resources in my jar
Then, the path you put inside the code is wrong
...
Maklegend u're kinda using the saveResource method erroneously
assuming its a resource
I might be - I'm just doing what you originally suggested
The bottom line is my files are not being found for some reason, and I can't figure out why that is
its in a subdirectory
why
aight
I mean yeah I could probably just get rid of it to make it easier
but this really shouldnt be this complicated
I mean it isn't
Can I screenshare?
sure
ok - should I join a channel or call
verify urself
that depends entirely on what your plugins are and how you wrote them
Well, the one I'm working on right now adds custom enchantments (1.16)
Some plugins already work, some will need to be updated to work on 1.17 with java 16
Okay
Generally speaking you need to update if:
- You're using any NMS whatsoever
- You're using reflection
I thought I saw some things were renamed
iirc I'm using reflection somewhere, I would need to look again, though
Then you'll need to update
Nothing is mapped at runtime, NMS classes are now properly packaged as opposed to being shoved in the same package, and any call to setAccessible() is illegal
Oh
im trying to make it so when axolotl spawn they are always swimming (even out of water) but imma be honest i have no clue what im doing this is what i have right now but it doesnt set them to swimming
public class MobSpawnListener implements Listener
{
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onCreatureSpawn(EntityToggleSwimEvent event) {
Entity entity = event.getEntity();
// System.out.println(entity.getType());
if (!entity.getType().equals("AXOLOTL")) return;
if (!entity.isInWater()) {
LivingEntity axolotl = (LivingEntity) entity;
axolotl.setSwimming(true);
}
}
}
You'll need to play with packets to do that, animations are client side
what i mean is like they swim in the air like squids do on that one purpur patch
kinda just ignore that they are out of water and move like they would in water
Well, I guess they're playing with packets on server core side to make it directly
Well, do the same thing you do with the actual commands, but with the : variants
Hello everyone!
Is there any way to check if a user has placed an item from their inventory into the custom inventory and also get the slot index? I have tried using InventoryMoveItemEvent but am unable to get the slot id/index
Is it possible to just say, copy MCA (region files) and change the names of the files, and effectively copy paste chunks?
Yes, but no
what's the yes and whats the no
Yes, you can copy/paste/change the name of a region file
no don't do that
Firstly, you'll not be able to do it while the server is running
Cause it locks the world
then, the world, will mostly likely be corrupted once you'll do any modification by hand
That's a big no no
why not :(
lmao I cant add it when the servers running
theres no way to add a large island, it'll crash
mmm
this probably shouldnt be here
but help-server is mostly for plugins and stuff
this wouldnt have to be done automatically, like on command or at a specific time
perhaps someone has a wiki on the MCA file format?
The MCA format has changed a lot since 1.16
And it's a real mess
more than before
So, yeah, you can try to mess with it, but it's a risk for you to just corrupt your world and lose time tbh
well then, seems I'll have to look at FAWE
Does anyone know if there's been changes to the everyoneSleeping function due to the new Minecraft mechanic that (I think) lets servers skip night with only a fraction of the server sleeping?
what do i need to do so that kits.yml comes with the plugin? because when doing this, it isn't added when i implement hte .jar into the plugins folder
do you have resources defined in maven?
how to i do that
So I have this ```java
private void checkUpdate() {
if (this.getConfig().getBoolean("Check-Update.enable")) {
Logger logger = this.getLogger();
new UpdateChecker(this, 93152).getVersion(version -> {
if (this.getDescription().getVersion().equalsIgnoreCase(version)) {
logger.info("There is not a new update available.");
} else {
logger.info("There is a new update available.");
}
});
}
}
i invalidated/refreshed the cache last time cause every thing was broken when i reset intellij to its defaults
The api caches versions up to 6 hours
oh ok so all I gotta do is wait
How to make, if the player does not have permission, hide the command (write as an unknown command)?
if the player does not have the permission node to the command it's automatically hidden
you can set its permission-message to unknown command string in plugin.yml
Is the /fly from essentials?
the command is automatically hidden if they don't have permission to use it
make a permission node for the command in plugin.yml
set default to false or op to true
and if they aren't a server operator the command should be hidden
you can also optionally set permission-message of command in plugin.yml to the unknown command string
Did the code change for loading worlds? Or is spigot glitched after this update? My code for loading worlds in previous versions no longer works.
new WorldCreator("world_name").createWorld();
jsut checked and ido
can someoen read my new commit thx
i want to know if thers something wrong with It
I can write a code review tmrw
Ok
Remember me to do that tmrw also thx (:
Believe it doesn’t support reflection yet
Animasi studio seperti Pixar atau Disney, menampilkan beberapa teka-teki yang berhubungan dengan film-film mereka. Bahkan ada juga loh guys, petunjuk mengenai film terbaru yang akan tayang dibeberapa tahun mendatang dan mungkin luput dari pandangan kita.
Bagi kalian yang penasaran seperti apa aja teka-teki atau petunjuk yang terlewat itu, kita...
Can i change the MOTD via a command?
vanilla cmds dont exist from my knowledge but u can download plugins for it
i want to make my own
serverlistplus
oh
ok
so
let me actually see if any methods exist to change via a cmd
i want to change the Server page MOTD
yeah, bc ik you can do it via config file but im trying to get it all commands
what i think i could do, is just with the command take the argument and place it where the config would be at. then reload the server
Okay thank you
from online internet:
@EventHandler
public void countDown(final ServerListPingEvent event){
if(gameHasEnded == true){ //if the game is in where it should countdown (lobby)
this.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
public void run(){
int countdown = 60; //count down for a minute (60 seconds)
if(countdown > 0){ //if the countdown isn't at 0
countdown--; //take one away from the countdown
event.setMotd("Next Game: " + countdown + " seconds"); //set the motd as the time until the countdown hits 0
}
if(countdown == 0){
gameHasEnded = false;
event.setMotd("A game is currently in session!");
//here you put your code to start the hunger games
}
}
}, 20, 20);
}
not mine, i just searched "how to change server motd spigot" online
and 1 spigot thread was one of the results
is there a method to teleport someone to the worldspawnpoint?
player.teleport( world.getSpawnLocation() );
I got another idea
How do i build with gradle in intellij?
gradle build
there are plent tutorels on online
I have no idea how intellij works
I just downloaded it
nor do i know how gradle works
Hyper join general 1 I will show you
bet
Is there anyway to currently fix this or do I need to compile craftbukkit and just not use mojang mappings
Have your motd read from a string in your config.yml and create a command that changes that string and updates the config.
you don't need to reload the server for it
@EventHandler
public void onSpawn(CreatureSpawnEvent event) {
if(getConfig().getBoolean("Zombie-Spawn-Netherite") == true){
if (event.getEntity() instanceof Zombie) { //check if the creature that just spawned (event.getEntity()) is a Zombie
EntityEquipment entityEquipment = event.getEntity().getEquipment(); //Obtain the entity equipment from that zombie
entityEquipment.setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE)); //set chestplate to that entity equipment
entityEquipment.setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS)); // repeat with leggings
entityEquipment.setBoots(new ItemStack(Material.NETHERITE_BOOTS)); // repeat with boots
entityEquipment.setHelmet(new ItemStack(Material.NETHERITE_HELMET)); // repeat with helmet
entityEquipment.setChestplateDropChance((float) 0);
entityEquipment.setLeggingsDropChance((float) 0);
entityEquipment.setHelmetDropChance((float) 0);
entityEquipment.setBootsDropChance((float) 0);
event.getEntity().setHealth(getConfig().getInt("Zombie-Spawn-Health"));
event.getEntity().damage(getConfig().getInt("Zombie-Damage"));
event.getEntity().getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(getConfig().getInt("Zombie-Damage"));
}
}}
``` Im confused
should the generic attack damage work??
Is there a way when loading a saved world for it to get .generator() from the files without you having to hard code the generator?
I just want to supply the string "world name" and have it load.
Wasn't there pinned messages in this channel?
About what?
Is there a github link to post a bug for End Islands for 1.17?
edit: Jira bug posted
now if only you were on a current version
the worst thing about working with devs in Europe is their spelling
Can I share a piece of Mojang Mapped code on the SpigotMC forum or do I need to remap it?
It's just a class
Get out
British English is the superior language
disaougree
Now, the slang
Don’t get me started
Also, ‘T’ basically isn’t a letter in a British accent
*bri’ish
is it just me or
is changing player attack speed broken
every time I change it to any other value than default, it resets
it's the correct form tho
colour, honour, flavour etc
Player targetPlayer = args.length > 0 ? Bukkit.getPlayer(args[0]) : sender instanceof Player ? (Player) sender : null;``` mmm
i am in horrour
i thought you were BatshtBrazil
How to get NBTTagList from NBTTAGcompound?
This is how i store NBTTagList to NBT Items
NBTTagCompound comp = it.getTag();
NBTTagList l = new NBTTagList();
NBTTagCompound v = new NBTTagCompound();
v.set("Skill1:", NBTTagString.a("0"));
v.set("Skill2:", NBTTagString.a("1"));
l.add(v);
comp.set("XSPetsSkill", l);
it.setTag(comp);
---------------------------------------------
I am trying to get NBTTagList but its send me []
NBTTagCompound tag = it_checker.getTag();
NBTTagList List = tag.getList("XSPetsSkill", 9);
p.sendMessage("XSPetsSkill: " + List);
why are you using nbt directly
I've been looking at various forums. They recommend using it like this.
whoever various forums is, he's wrong
hey
i like you
your weird way with words
do you are want to is kiss?
muwah
that's me
i know
how
behind u
WHAT
heyy
get out of my house
how can i do crafting like crafting enchanted stuff hypixel skyblock
i am tring to make a readme generate but it is giving me an error. the code i am using is saveResource(getDataFolder().toString() + "README.txt", true); anyone know how to fix it
well you are trying to get the resource "pluginNameREADME.txt", not "pluginName/README.txt"
o ok thanks
Also, why getDataFolder().toString()?
because it takes in a string
This is a major red flag to me
why not Integer.parseInt(getDataFolder())???
no, but if saved you will have a dir structure like
plugins
pluginName
pluginName
README.md
i am trying to save it in the save place as the config folder
So just do saveResource("README.txt", true);
o ok thanks
Also, it will overwrite the previous file if present
Hello, i can't find NMS 1.17
import net.minecraft.server.v1_17_R1.Packet
gave me Cannot resolve symbol 'v1_17_R1
it does not exist
Spigot appears to now use Mojmap (please correct me if I am wrong, thx)
how can we use packets then_
use your ide to figure out the new import
any decent ide is going to suggest an import for you
Is it imported in the api? I thought you’d have to source the actual jar to get access
Oh he is sourcing the jar, for some reason I thought he was doing it via reflection 🤦♂️
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
playerConnection not found, what should i use?
not directly, no
@grave mason i guess not
a packet sent in during play to steer a vehicle
i want to know how to get the location of an attack done by a player on an entity, Before the entity takes knockback
in protocol lib
Use your ide to figure it out
The field names have changed
Look at the types of the fields available
why does this not work?
p.getInventory().addItem(new ItemStack(Material.APPLE, 16));
p.getInventory().addItem(new ItemStack(Material.WOODEN_AXE));
looks fine to me
it gives nothing to the player :/
Does the player have room in their inventory?
yes
where are you calling the code
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
should work
Did you register the event in the onEnable?
How to use PacketPlayOutScoreboardTeam in 1.17?
It doesn't works:
Constructor<?> constructor =
Class.forName("net.minecraft.network.protocol.game.PacketPlayOutScoreboardTeam")
.getDeclaredConstructor(String.class, int.class, Optional.class, Collection.class);
constructor.setAccessible(true);
Object object = constructor.newInstance("test", 0, Optional.empty(), Lists.newArrayList(p.getName()));
Packet<?> packet = (Packet<?>) object;
why the f*ck do you need packets
It's b
did you even read the 1.17 release notes
yes everything whats there works except for that
It pains us to say this every time, but NMS is not API. When you are trying to figure out how to do something, the first move should never be packets or NMS. Bafflingly almost daily we see people bypassing the API to do simple things such as Scoreboards, BossBars, or Particles. There is no reason to do this. Ever. Fully-featured APIs for these things have existed since Mojang added them.
I red.
Change playerConnection to b
Tested because you're bored 😛
I need to use it anyway
no you dont
I'm not helping you use packets for scoreboards and no one here is either
this has to stop
where do you find?
Ok... How I can display player's prefix in tab + over head in other way?
Just open the class and look. md_5 has a very good point
learn to use your ide bro, it will tell you these things. ctrl+space (or similar) to bring up autocomplete, look for the type you want
without using packet reader?
create a scoreboard + team, set the prefix, and add the player to it
sorry i found it yes
search the javadocs for scoreboard and team
Tab has a playerListName or whatever it's called.
thanks
That's like /team, right?
don't use commands to create scoreboards, this is the exact definition of what not to do
k
i'll try scoreboard + team
Search the java docs and look how to use Teams and Scoreboards.
i think my pom.xml still use 8
Then get that fixed
If you use 1.17 update to Java 16
Hi, what's the intended behaviour of players which have setSleepingIgnored(true)? I'm not quite sure from the docs. Is it intended to be that if the developer wants a player to not be counted towards the sleeping counter (regardless of whether the player is active or not) they should set setSleepingIgnored(true)? If so, I think the 1.17 update is broken in that it doesn't let you go to sleep if the only player on the server has setSleepingIgnored(true).
ye 1.17 acting up
Do /version How many does it say you are behind
1.17 changed sleeping code, suggest you open a bug report
but also not sure how sleeping ignored with only 1 player world work
/version says "You are running the latest version"
How can I reduce a tools durability?
sleeping will only advance if > 1 player required to sleep is actually sleeping
itemmeta?
With ItemMeta
I feel like that's kind of sensible behaviour, though no idea if its different from 1.16.5
I think if all players have setSleepingIgnored(true) then they can't sleep, regardless of how many are actually in beds.
Is that how it's supposed to be?
(I haven't actually tested that, that's just from looking at the code)
What function do I need to use ?
it doesnt look like that espect is different from 1.16.5
Check the ItemMeta docs, It's quite simple
hmm or maybe it is I hate booleans
!(entityplayer.isSpectator() || (entityplayer.fauxSleeping && !entityplayer.isSleeping())) what does that simplify to
does anyone have a boolean simplifier lol
damager.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(1024.0);
``` for some reason this doesn't work for me :/ atk spd always reset to 4.0 after the first hit
Is there an event for interacting with Blocks?
PlayerInteractEvent
thx
I think you might also need to track if any players are sleeping, since if you just count active players and players that are "sleeping" (whether it be real sleep or faux sleep) then when you have all players faux sleeping you constantly trigger the "set it to daytime" code
I'm too tired to be sure about this now, suggest you open a bug report and/or pull request
sleep well 😘
Update spigot
i have
do you want i send my plugin to you?
sure
fr
how do i get the location of the entity being hit in protocol lib?
How to use special-source maven plugin? It cannot find an artifact for some reason
/scoreboard and /team commands are broken after creating scoreboard + team by spigot
what the f*ck, md_5?
it sounds like you
need a snickers bar
because you're not you when you're hungry
hey
hi
yes you are md_5 when you are hungry it seems
@quaint mantlei like classroom of the elite too
yup
don't get too attached to it though, i'll warn you, there's a huge plot twist at the end
and depending on what type of person you are, it might be disappointing
and potentially make you dislike the entire anime
ah I see, that's got me interested then
How am I able to add a custom smithing recipe?
Bukkit.addRecipe(new SmithingRecipe
is vim can be used the spigot plugin for it?
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
//get Player locations
}
}, 0L, 1L);
Oh yeah It's just copied but what do you mean by never accessing the Bukkit API? does it mean that I can't get player locations and stuff?
because I am making something that needs to check if someone entered a specific location
new BukkitRunnable() {
@Override
public void run() {
}
}.runTaskTimer(long plugin, long delay, long period)
whats the difference of this
from that
nothing
it's the asynchronous tasks where you don't want to access certain parts of the api
so it doesn't matter which one i choose from those two?
how the plugin can be used from 1.8 - 1.17
the biggest difference is that getScheduler() accepts a lambda, while new BukkitRunnable always requires an anonymous class
so the former is preferred unless you need a BukkitRunnable
which are only generally needed if the task needs to cancel itself at some point
have you ever used vim before to program
no, i'm not gay
what do you mean by that
personally, I hate vim
i'm looking for like an astro-like theme for intellij
can't seem to find any
like one of those command line-type things
like a terminal
Hello, how can I have the file config.yml of another plugin ?
How can I change an ItemStack to a RecipeChoice?
you don't
an itemstack is an itemstack
a recipechoice is a recipechoice
you can't change one into the other
however, you can create a new recipechoice based on an itemstack
see the constructors in the javadocs
Sorry but can I get the config.yml of another plugin ?
So does RecipeChioce#test(itemStack) base the recipeChoice on the itemStack?
no.
RecipeChoice::test uses an existing recipechoice to test an itemstack
you want a new recipechoice
recipechoice itself is abstract and cannot be instantiated
but the api provides two concrete subclasses that extend it
take the one you need and call the appropriate constructor
wait you can use :: in java like in C?
ye
it can be used in place of a lambda when the method contract fits the context exactly
f.e if you have a void method, you could either do
class MyRunnable implements Runnable { @Override public void run() { myVoidMethod(); }}
runTaskLater(plugin, new MyRunnable());
runTaskLater(plugin, new Runnable(){ @Override public void run() { myVoidMethod(); }})
runTaskLater(plugin, () -> { myVoidMethod(); })
runTaskLater(plugin, () -> myVoidMethod())
runTaskLater(plugin, this::myVoidMethod)
{"character_count":3329,"character_limit":500000}
i have this reponse from an api.
gsonInstance.fromJson(content, CharInfo.class);
class CharInfo {
int usedChars;
int totalAllowed;
}
im trying to do this ^^ But it doesn't work. what should i be doing instead?
I assume it is a different data type or something?
You need to name your variables same as the json
ohhhhh yeah ><
Or else theres some annotation somewhere you can use
you can also register class specific serializers with gson
ok - so a while back i accidentally posted an api key in a github project. don't ask how. is there a way to actually remove it?
cause you could just go thru the commit history and get it
invalidate the api key
oh yeah - lemme try
even if you manage to delete it by for example deleting the whole repository, someone could have saved it already
same thing as if you lose your keys
even if you do have a spare key, you still need to change the locks
because now there's a key going around and you don't know who might still have it
its a private repo but i was considering just making it public instead of deleting + re creating
Been there
lmao
Was also like 60 commits deep with a group project
thats the same for me
But we had to make our repo public because the teachers wanted the github insights
Yeah, it was for a school project. And they wanted to see who did the most work I guess
Although github insights is not really a fair way to compare work done, but sure
anyone know an intellij plugin that makes editing code like google docs
so you can collab with people
Dont they just have this liveshare function?
yeah - cause there could be a line that some1 did that was really difficult or something. they had good intentions
idk
CodeTogether on Eclipse. No idea if its on InteliJ though
or use @SerializedName("yourName")
Mostly because the skill level kinda varies alot. So for someone like me it might be alot easier to code a few thousand lines then for someone else in my group.
So even tho they still put in the same hours, the github insights will tell that I did triple the work
That's true, but its still a team effort. And I wouldn't want to bring my team average down, just because they commited les code than me
Intellij has code with me but it relies more on one person being on at the same time
looks ok tho
fair
Yeah true, well I've never really felt any benefit in coding in a google docs kinda way anyways. So can't really help you anyfurther sadly.
Yeah - what i kinda wanted is that there was a service that hosted ur code or something. then ur ide would just hook into the server and send ur code up as u type and then down to all other 'consumers'
If anyone here knows how to do it. please make it
just hit the commit button every 50 milliseconds
lmao
is there some way to get an uuid out of an GameProfile?
most likely
hi, how can i give an perimission (exemple.use) in one lign of code
if you're using a permission system on a server - i believe most use vault so just hook into vault and their permissions api or the plugin itself
if it's luckperms highkey use their api
if u wanna do it manually with only spigot api you'd be using permissionattachments i believe
i will if an player join the server, he have an permission for use exemple.us
you can use Player#addAttachment to get a PermissionAttachment object
and from there you can use PermissionAttachment#setPermission(String name, boolean value)
player.addAttachment(plugin, "example.use", true);
Does somone know, if it is possible to mak e a nightvision helmet?
@maiden thicket @eternal oxide thanks you
what do you mean - like a helmet gives night vision?
i don't know if it's possible to create a helmet with nightvision but you can give and remove nightvision from the player when the equip and unequip the helmet
Yes!!
If I got a list of 7 things for example, how can I make it randomly select only 3 of them?
That is possible?
Could you please tell me how? xd
do a for loop with a limit of 3 runs and choose the item with ThreadLocalRandom.current().nextInt(list size here);
it'd be like
playerre.addAttachment("realitemcplugin", "tpmin.use", true); it does not work
that may return the same element several times
And does somone know the id of green leather chestplate?
thats not what I told you to use. Look at it and see what you did wrong
u'd have to do a while loop to make sure it doesn't or you can create a copy of the array and remove the items @wraith rapids i think ?
i think that's how u do it
i usually do a while loop cus im weird lol
there is an efficient way of doing it but I don't remember it off the top of my head
i think you would start at index 0, pick a random element between 0 and arr.length, and swap
then repeat for index 1 and 1-arr.length
and so on
@maiden thicket o.o Do you know the item id of green leather chestplate?
ANd how to make this with a nightvision helmet? xd
List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
List<Integer> ints2 = ints;
for (int i = 0; i < 3; i++)
{
int index = ThreadLocalRandom.current().nextInt(ints2.size());
int item = ints2.remove(index);
}```
i think
that's how u'd do it
lol
that is inefficient
u may have to use the armorequipevent plugin bc i don't believe an event exists yet for that
as you have to shift the entire array for each remove operation
oh
then
what if you did it backwards
oops
nope
that's not
lol im not thinking uh
are you just trying to randomize the list?
You can change the itemmeta (LeatherArmorMeta) to set a green leather chestplaste with setColor()
Okay, thank U!!
so, its that ? Player permnouv = PermissionAttachment();
Thank u!!
https://www.spigotmc.org/resources/lib-armorequipevent.5478/ you can try this... but i don't know if it'd work good on latest versions
and then just check if the i think... new armor piece?
equals ur helmet
no, the exact code I gave you will work. all you have to provide is the player and the plugin instance
new armor = equipping
Old armor = unequipping
just check if new is helmet and if so apply night vision
if old is helmet then remove night vision
Player player = ...; //initialize your player here
player.addAttachment(your plugin instance here, "example.use", true);```
I will try it!! Thank u!!
I have problems with change the color of my leather chestplate xd
did you set item meta
thx but what are the "your plugin instance here" ?
I have already set one o.o ItemMeta meta = emeraldpickaxe.getItemMeta();
cast to LeatherArmorMeta
your main class
ItemStack item = new ItemStack(Material.LEATHER_HELMET); //new itemstack instance
LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta(); //cast itemmeta to leatherarmormeta
meta.setColor(Color.GREEN); //set color
item.setItemMeta(meta); //set item's meta```
ok
i must create an local variable ?
no X)
ok
sadge
Tysm!!
np
sorry
this gonna be muy dificil if u dont know java xd
yes x)
Everything is Java is designed around objects. Every object is an instance. When your plugin is loaded by Spigot it creates an instance of your main class. If you are in your main class code you can refer to that instance using the keyword this
ok, thank you
If you are in another class you have to pass an instance of yoru main plugin class to it, which is called Dependency Injection
mess around w https://regexr.com/ xd
i hate regexes but that website makes it easier
i tried
f
too dumb for it sorry
felt that
i am in the listener and not in the main, so what i do ?
sadge
whats the name of ur main class
there is a static method in JavaPlugin where u can just do
ClassName.getPlugin(ClassName.class);
i dont usually do that
like ever
xd
Then you need to pass an instance via your Listeners constructor
btw what im trying to make is color highlight for minecraft configs
so you can see minecraft colors in the editor itself 🙂
By default your Listener will not have a constructor.
oh that sounds epic
there is a regex i believe you can use to find colors
it's in the ChatColor class
private static final Pattern STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('§') + "[0-9A-FK-ORX]");```
this thing
to pass an instance to your Listener instead of using new YourListener() you use new YourListener(this), and add a constructor to your listener class.
basically what it does is it changes &6 for example to gold
Can we put a tabcompleter on other things than commands?
I want a tabCompleter of all my connected players when someone write a "@"
Not possible server side
😢
But minecraft is using a tabCompleter for players without a slash required
Can't we reproduce it?
Yeah, they would be using Packets to do it most likely.
ok I will look at it, thanks.
Does somone know how to set an item lore? xd
item meta
ItemMeta
When i do this like that:
meta1.setLore("Unbreakable"); it is red o.o
Code?
i swear fawe is one of the best things client side but worse things coding wise. I just can't work out how on earth you're supposed to just load and paste a schematic then scan the pasted region
Arg in setLore must be a list<String>
What does that mean? xd
setLore uses a List<String> not a normal String
Create a list, add the things to the list and set the lore as a list?
I don`t understand that :C
meta1.setLore(Arrays.asList("line1", "line2"));
You need to create a new List<String> and add the lore that you want and then set that List<String> to the setLore
Tysm!!
Hey Guys! I need help. I want to copy the world folder. In the Mc 1.16 it worked with FileUtils but i updated to Java 16 and MC 1.17 and don't work anymore.
@manic furnace Why not write your own file copy utility? https://stackoverflow.com/questions/6214703/copy-entire-directory-contents-to-another-directory
java File API might have changed from Java 8 to Java 16 slightly
Just use Path and Files?
ok so i do new mainrealitem(this) and i do player.addAttachment(mainrealitem, "tpmin.use", true); ?
no, you never use new on your main class. There is only ever one instance of that. Its created by Spigot.
ok so what i do ?
what line do you create your Listener instance?
how do i create a 1.8 plugin in intellij? the thing only goes down to 1.12
what is the line of code you use to create your listener instance?
line 16
show the line here
show your code
getServer().getPluginManager().registerEvents(new realitemlisteners(), this);
I tryed that
change that to getServer().getPluginManager().registerEvents(new realitemlisteners(this), this);
it will then underline in red
hover over it and one of the options in there will be to add a constructor to your listener
i have create the constructor and what i do ?
now you create a Field in your listener class, above your constructor
show the constructor it added.
public class realitemlisteners implements Listener {
public realitemlisteners(mainrealitem mainrealitem) {
// TODO Auto-generated constructor stub
}
above that constructor add mainrealitem plugin;
why ?
then replace the TODO with this.plugin = mainrealitem;
You are creating a reference to your plugin instance so it can be used in yoru listener
this.plugin = mainrealitem;
now if you have done all as I say your permission code should be working
it works ! very very thank you 👍
np
no problem
ok
Hello!
anyone facing that the server crashes whenever using a command from plugin in 1.17 spigot?
Is it like any command, or a specific command?
?paste the console error
its anything with a gui
1sec
if its an index out of bounds error, run BuildTools again. You have a broken build of Spigot
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
how can i execute an command as an player if the player are not op
Give them permission to the command.
no, i wouldn't give the command to an player (its a /function)
https://paste.md-5.net/unagofugix.nginx Am I doing something completely wrong or? I'm just trying to load and paste a schematic using fawe :/
Remove op and add it back. Or if it is your own command you can set the permission not to be default for op
You need to run that async if you're using FAWE
no ! i have an idea but thank you
@chrome beacon I can't even get it to work in the code, it doesn't know how to work together.
What do you mean?
Like, I can't work out how to do the clipboard things and the session builders at all.
There's a lack of documentation and such on how to do these things using FAWE so it makes it harder for everyone.
You use the normal WE docs
how can i execute a command with a concole (in one line of code)
And they have their discord for help
I mean, FAWE needs certain world things right?
?
Bukkit.dispatchCommand
they say about doing the Clipboard things, but they give like 3 lines on it that's all.
Bukkit.dispatchCommand("my command ?")
I still have no idea what your issue is
Yeah there's another argument
They make no mention of it in the docs nor where to get that from. They need to rework the docs I think.
Here is my own utils for pasting schematics
It's WorldEdit bound though, change the editsession to a fawe one
From what I found from a simple google search... you get it from their world. You get the world from the bukkit adapter
How did you find how to do that? There's so little docs.
It's not just me being dumb, it is hard to find these things right?
I looked at the WorldEdit doc ^^'
Or do it like this
This
lmao
Well, hard to read for sure, but once you understood, it's ok
They also have a discord
Where's the WorldData in the worldedit? It's not there for me.
BukkitAdapter get world then data from that
Wait how did you add an integer to an integer list in bukkit yaml api? xDD
how can i do a reference of the console in a command sender
ConsoleCommandSender
Are you wanting to check if the commandsender is console?
if (sender instanceof ConsoleCommandSender) { to check if sender is console
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "cmd"); to run command as console
not but i will use the console for execute a command
thank you
Then
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say Hello world!");
Anyone?
Do I get the integer list, add the new integer and set it?
I got no luck with this. I didn't realise WorldEdit was like this.
what does player.updateInventory does?
Is there a way debugging Plugin events also anything what a plugin does?
So, inside the BlockBreakEvent, Im just doing some checks to see whether the mined block is COAL_ORE or IRON_ORE, and everything works perfectly fine, until I mine a "Deepslate" ore. Then my entire server will freeze and crash. "OutOfMemoryError"
how many RAM do u have allocated to it?
?paste your code
1GB, I also tried 2GBm same error
yep sure, give me a min
well, when he only has his plugin installed it's likely an Memory leak or smth
True
Does spigot still support Java 8-15?
1.17 only 16 iirc
^^
The Change is bad tho bc u got to rewrite the plugins u use
you have to update, then install a patch @sour rampart
Cursed you should be able to type those
There's more in this class, it's just the same repeating for diff ores
Does anyone know how to support multiple minecraft releases? You can just create a zip file with your plugin built for different versions, but how can I make my plugin choose which versions to use?
This code will never end while ((block = list.poll()) != null) { getConBlocks(block, set, list); }You never remove from the List
Can someone help me update my eclipse to Java 16?
First of I recommend using Maven and per version modules. Get the version and select class to load from that
When exactly should I remove it from the list?
if you get what I mean
https://crackhead.cocaine.solutions/r27I0qoi spigot 1.17 be like.
list.poll doesn;t remove
Is that only happens in me?
Is maven or gradle hard to use or am I just very stupid, I have tried using it but don't understand it. I think I'm going to look up some learning resources.
Don't listen to BlockEvent
However, it will never end as you are gettign relative and you get teh original block to readd
https://crackhead.cocaine.solutions/r27I0qoi spigot 1.17 be like.
Is there a way I can "make it end", and still have it work ElgarL?
yes, you need to check if its in the Set before you add it to the todo
if its already in the Set you don;t add it to the todo
I dont
I am using events which extends BlockEvent
Is it a custom event
So like this?
private void getConBlocks(final Block block, final Set<Block> results, final List<Block> todo) {
for (final BlockFace f : blockFaces) {
final Block b = block.getRelative(f);
if (b.getType() == block.getType()) {
if (!results.contains(b)) { // added this
if (results.add(b)) {
todo.add(b);
}
}
}
}
}```
no
?paste code
probably
That still causesthe same issue ElgarL
Hm okay. I would try updating spigot. There are a lot of small bugs after a new version
ok
That code looks fine to me now
It just crashed my entire server still 😬 , do you think it could be a spigot bug?
Is anyone getting an error similar to ```
Couldn't load chunk [-32, 23]
java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
Trying to narrow down a stacktrace I've been getting
private void getConBlocks(final Block block, final Set<Block> results, final List<Block> todo) {
for (final BlockFace f : blockFaces) {
final Block b = block.getRelative(f);
if (b.getType() == block.getType()) {
if (!results.contains(b)) {
if (results.add(b)) {
todo.add(b);
}
}
}
}
}
private Set<Block> getConnectedBlocks(Block block) {
final Set<Block> set = new HashSet<>();
final LinkedList<Block> list = new LinkedList<>();
list.add(block);
while ((block = list.poll()) != null) {
getConBlocks(block, set, list);
}
return set;
}```
Looks like a trivial error to me
Show code (:
?paste full error and make sure you're using the latest version of spigot
Is there a new 1.17 build already?
Already wdym
As in is there a second one? I just built this 1.17 jar this friday
Run /version and find out
if you comment out line 25 it all runs fine, just no message? p.sendMessage("Found a vein of " + getConnectedBlocks(block));
I just noticed, I work with a toggling system (use a command, get added to a List, use it again, get removed). If you have it toggled, it will send notifications if a player mines a block, if its toggled off you wont get noties, now, I found out if the notifications are toggled OFF, everything works smooth, but if they're toggled ON, it crashes
so the error now is in yoru notifications then?
Well, if you are toggled "off" (not inside the list), you won't get any errors/crashes if you mine deepslate. But if it's on, and your UUID is inside the list, it crashes
your talking about your veinMap?
No, so. I've got a HashSet<UUID> notifications;
Ifyou do /notifications, your UUID will be put inside that map. If someone breaks a block and is INSIDE the HashSet, they will be sent a message saying "Hey, player X broke a coal ore"
if you get what I mean
then your error is in that code, not the breaking/counting
But how would that affect anything? Because it's only checking for a UUID, and the only difference with toggling on/off is basically getting sent a message or not
you are crashing because you ran out of memory, that means somewhere you are looping infinitely.
Mhmmm
alright one sec
This is how I send messages
if (block.getType().equals(materials.get(0))) { //coal
if (veinMap.get(minerUUID) != block.getType()) {
veinMap.put(minerUUID, block.getType());
plugin.getNotificationToggle()
.stream()
.filter(uuid -> Bukkit.getPlayer(uuid) != null)
.forEach(uuid -> Objects.requireNonNull(Bukkit.getPlayer(uuid)).sendMessage(ColorUtil.colorize(player.sendMessage("mined a total of " getConnectedBlocks(block);
}```
I updated spigot to latest version still has the same error
Why are you doing all that stream/filter?
Making sure there's no nulls
you are calling Bukkit.getPlayer twice for every entry
And you are sure this is the only listener class
Alright, I'll clean that up. That wouldnt cause any of the issues tho, right?
And that you're running the latest version of your code
yes
You literally just check if the player is in yoru notification toggle, then send a message
Which one is on line 81
InGameListener
Thats whole InGameListener class
yea
Yarin you do know stream has a Map function
I'm going to assume you keep showing me pseudo code and not the code you are actually using as it keeps changing a LOT
plugin.getNotificationToggle().stream().map(Bukkit::getPlayer).filter(Objects::nonNull).forEach(player -> {...});
In the code you are showing me your code only ever runs for COAL_ORE
is there anything wrong with my code i dont see anything wrong
How would I simulate block breaking? Meaning, the block is cracking and taking damage without me actually mining it.
then when its at max, use breakNaturally on the block
Gotchu. Thank you
Yea, I just showed it for that, but it the exact same for iron, gold, etc
why do you not just check for contains?
at this point (from what I've seen) your code is now fine. If its still crashing its due to something in XMaterial in relation to that block. I'd guess its matching on everything
You could put a debug in your block fetching code to simply print the total in yoru set everytime a block is added
You will then see if its going forever
Alright ill try tjat, thanks
what's the best way to go about teleporting entities with passengers?
I'm trying to set a PDC but when i do a check just after it returns false in console. I did it for other items, but this one doesnt seem to work. Any tips?
You have to put the meta back on the item
I did
https://paste.md-5.net/ihobizijem.cs
my server crashed every time on 1.17, also tested on 1.16 and there was no problem
?paste
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.entity.EntityAccess.getBoundingBox()" because "var1" is null you have a corrupt world. Update yoru 1.17 Spigot (run BuildTools) and generate a fresh world.
This is whole code, did I wrongly put back the meta?
You need to get teh meta before accessing the PDC
any idea how to stop this regex
(&l.*)(?=\\\")
after " or &?
not just "
You are currently getting two different copies of your meta and overwriting your PDC
So I put the ItemMeta playerbow_meta = playerbow.getItemMeta(); before the PDC
yes, and get the PDC from the playerbow_meta
it was an new world
that can not be the problem
Ok thanks
if you say so.
Delete world and try again
Also make sure you're up to date
The first time you generated your world on 1.17 you had an error in your console, which you ignored.
i downloaded it from here
please do not download spigot
nononono
downloading is illegal :weewoo:
Not these sites
whut wdym?
spigot jars contain mojang code
pages that provide spigot downloads are breaking the law and might, especially rn, be outdated
An unofficial explanation of the DMCA can be found here: https://www.spigotmc.org/wiki/unofficial-explanation-about-the-dmca/
Distributing Spigot jars is illegal, run BuildTools and it will make a new jar for you.
Plus spigot is in the gray area of laws either way by continuing software that got DMCA'd
?bt
put in 1.17
World Edit is not dead right?
How to find out with whether the player is eligible (From the BungeeCord server)? Plugin for LuckPerms perms (The server and BungeeCord are connected to the database)
Hi, I got this code right here: https://paste.md-5.net/ovehanomew.java
I'm trying to do so it selects 5 random arenas from the config and puts them in the mapID hashmap (String, Integer) but it doesn't seem to work. It keeps spamming this warning in the console: https://paste.md-5.net/ofarojanof.bash. Line 71 is for (int i = 0; i <= 5; i++) {
Did you delete your world?
?paste your full startup log (latest.log)
remove MTVehicles, its clearly broken
its my own plugin lol
does it use nms?
for items
have you built it against 1.17?
?
on 1.16 i dont get that problem
1.17 is different
Quite possibly
There was a near identical error yesterday on worldgen, which is why we went over a new jar and new world.
So, if (results.add(b)) { is the "issue" here. if I mine a 4vein of emerald it works, and sends 4 "false" messages, but as soon as I mine deepslate ores it spams the console with "FALSE"
maven is giving me this warning when building, does anyone know how i can fix this?
this wasnt happening before and i didnt change any important code, just turned my random souts into logger.infos
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See http://maven.apache.org/plugins/maven-shade-plugin/```
Then you are hainvg a problem with XMaterial matching everything as deepslate
Mhm, alright
its new generated world
update to I think 3.3.0 shade plugin
its problem in 1.17 jar thats it
its mentioned in the form thread linked in #announcements
Seems likely
I can't believe it's the plugin
because it just works at 1.16
only other imports
and if there was an error there it would say that it is in the plugin
Yes, it seems to stem from at org.spigotmc.ActivationRange.activateEntities(ActivationRange.java:133)
'Cannot resolve plugin org.apache.maven.plugins:maven-shade-plugin:3.3.0'
even after loading project structure changes
check the forum post for the correct version
k
anyone know where the entityList for a world moved to?
3.2.4 seems latest
used to be
WorldServer handle = ((CraftWorld) this.world).getHandle();
handle.entityList.clear();
yeah its the one i was using and https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin says its the latest
hmm
I It doesn't support J16 though
You need to enable the snapshot repo, let me get an example for ya
well that explains it
oh this.world has it, i will try that
<pluginRepositories>
<pluginRepository>
<id>apache-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>org.example.bstats</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
can someone help?
public static ifConfigValueIsSet<boolean>(String ConfigValue) {
if (this.getConfig().getString(ConfigValue)) {
}
}```
https://i.imgur.com/99rIuZd.png
Generics do not support primitive values
So you'd need ifConfigValueIsSet<Boolean>
However even then it is wrong, but I cannot make out what you meant by it
perhaps you meant the return type?
i want to make a function that you input the label you want and then it returns if it's set
I get this error when trying to do this: https://paste.md-5.net/orawuxowar.bash
List<String> getArena = arenaConfig.getConfig().getStringList("Arena");
int index = new Random().nextInt(getArena.size());```
I got 5
How can it be fixed now?
Even without XMaterial I have the problem.. so weird
Have anyone an idea how i can change this in the BungeeCord source?
ElgarL (not gonna ping), fixed the issue thx for all the help ❤️
in the version
did you make sure that it is non-zero
nextInt()'s argument is exclusive
why does barrel not implement Directional
Im trying to make it give back the items the player put in a GUI when he closes it, but for some reason doesnt work when item 1 is null and item 2 is something. Only works when item 1 is something and item 2 is null or both are something.
I tried putting try/catch, everything but it doesnt seem to work
try checking for Material.AIR instead of null
and if it is null
then you cant call equals on it
it should be item != null
you should make the create the inv in the same class as the event, so you check the inv instead of the title
does anyone know where the source jar is for when I use buildtools --generate-sources option?
I tried both of them and many variants, can't seem to work
It really only works for item 1 and keeps throwing NullPointerException
or when item1 and item2 are full
not a clue, but the documentation instructs you to cast the result of getBlockData to Directional for a barrel https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html#BARREL
yes because you should check for null pointer too
if (item !=null && item.getType() !=Material.AIR)
I'm also curious why would getItem return AIR lol
as if AIR is stackable or can have meta or sth
Still doesn't work.

