Could not transfer artifact org.spigotmc:spigot-api:pom:1.17.1-R0.1-SNAPSHOT from/to spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/): Transfer failed for https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/spigot-api-1.17.1-R0.1-SNAPSHOT.pom
#help-development
1 messages · Page 1582 of 1
are you working with maven?
I'm changing arrows to 1 DMG by using the EntityDamageByEntityEvent
yes!
but when a player dies by an arrow the player who kille doesnt get credit
maybe that works?
/**
* Set arrows shot from player in a mini game only do 1dmg
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void onArrowHit(EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player)
|| !(event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
|| !(event.getDamager().getType().equals(EntityType.ARROW)))
return;
Player player = (Player) event.getEntity();
if (!PartyManager.inAMiniGame(player)) return;
event.setCancelled(true);
player.damage(1);
new BukkitRunnable() {
@Override
public void run() {
player.setFireTicks(60);
}
}.runTaskLater(plugin, 1);
}
im not experienced with maven
use e.setDamage
instead of the player.damage
bruh
you can do that?
I dont even need to cancel the event then right
it can just be ```java
/**
* Set arrows shot from player in a mini game only do 1dmg
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void onArrowHit(EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player)
|| !(event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
|| !(event.getDamager().getType().equals(EntityType.ARROW)))
return;
Player player = (Player) event.getEntity();
if (!PartyManager.inAMiniGame(player)) return;
event.setDamage(1);
}
World#getTime World#getFullTime World#getGameTIme
whats the diffirent?
Is this day time?
yup the magic of google
I mean i used google to arrive at my other solution so perhaps the magic is just more present for you
getTime os the relative time, getFullTime is how long its been alive (i think) and the getGameTime gets when it was created
thanks
try to fix your problem from another angle, in this case you dont need to cancel the arrow, its already there, you modify the arrow
I tried to modify the damage of the item but that would not work
this works just fine
i think thats the "normal" way of having time in a 24 hours cycle, meanwhile the other times are in either long or int
and are way bigger
0 is 8:00. Why it isn't count from 0:00
no idea
strange number of 1 minute
how do i get the name of the player for who triggered an event
then i dont know
getPlayer.getName
yea right
or getDisplayName
k
its me first plugin
?paste
ill be nice i promise
package bunk.dev;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import litebans.api.*;
public final class BanSmite extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
public void registerEvents() {
Events.get().register(new Events.Listener() {
@Override
public void entryAdded(Entry entry) {
if (entry.getType().equals("ban")) {
Player player = event.getPlayer();
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "/command";
Bukkit.dispatchCommand(console, command);
/* ... */
}
}
});
}
}
Can someone tell me the terms used while making a vehicles plugin so that i can google it.
When i google spigot cars plugin tutorial i get tutorials on setting up cars plugin.
i make so player get smite when ban
r u help
ok so first, register the event in the main class, getServer.getPluginManager.registerEvents(new CLASSNAME(), this))
in on enable
this will create a new instance of the class you are using
yes in the onEnable
Cannot resolve symbol 'getServer'
wat
idk
are you sure you did the setup correctly?
import stuff
i did
YouTube
Hello and welcome to TheSourceCode,
Here at TheSourceCode, our main objective is to have people learn to code alongside me. We are not professional coders by any means. But we have gained lots of knowledge throughout our years and we hope to share it with you! We hope to teach you something new and we hope you guys teach us something new!
watch his videos
they are really good
it says annotations arent allowed here
package bunk.dev;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import litebans.api.*;
public final class BanSmite extends JavaPlugin {
@Override
public void onEnable() {
@EventHandler
getServer.getPluginManager.registerEvents(new BanSmite(), this))
}
public void registerEvents() {
Events.get().register(new Events.Listener() {
@Override
public void entryAdded(Entry entry) {
if (entry.getType().equals("ban")) {
Player player = event.getPlayer();
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(console, "smite");
/* ... */
}
}
});
}
}
oh
remove that even handler
you dont need it there
and remove the registerEvents()
create a new class
name it whatever you want
and replace the BanSmite() with your class name
yes
ok
liekt hsi?
everything go red
the whole thign?
copy paste never works
this
never copy paste code you dont understand
yea nothing in java is quite that simple, you need to register the event, create the class, implement Listener, add @EventHandler, get the event, get the player in the event, and then get the name of the player
lol
watch the playlist i sent
it fixes the getServer error
waittt
i cant explain it like this
but u cant put in on eabele
nice
?
add implement Listener
package bunk.dev;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import litebans.api.*;
public final class BanSmite extends JavaPlugin {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new LiteBansEvent(), this))
}
public void registerEvents() {
Events.get().register(new Events.Listener() {
@Override
public void entryAdded(Entry entry) {
if (entry.getType().equals("ban")) {
Player player = event.getPlayer();
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(console, "smite");
/* ... */
}
}
});
}
}
in your class
this is my main class
remove the registerEvents()
the whole thing?
yea
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
read this
its gonna explain it better
youtube then
why not?
this easier for me
A wise man once said, "Programmers don't work without reading docs"
implements
nice
what do i put in the event class?
Bump
?
@sharp bough
i got the thign done
package bunk.dev;
import litebans.api.*;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
public class LiteBansEvent implements Listener {
public void registerEvents() {
Events.get().register(new Events.Listener() {
@Override
public void entryAdded(Entry entry) {
if (entry.getType().equals("ban")) {
Player player = event.getPlayer();
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(console, "smite");
/* ... */
}
}
});
}
}
this my code
but
the
no
oh hell na
stop sending 40 messages at a time, read the goddamn documentation you were sent, and figure it the fuck out
u said u wouldnt make fun of me
great analogy lol
the first part applies to you too lucas
it happens here
happens to me as well
if you were willing to learn
we have to live with it until we become a pro at this
the same question over and over is not a way to learn
you learn by reading the docs i sent, the yt link i sent
yes it is
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
and those links
dont bruh me
Bump
clearly it wasnt done since it didnt work lol
dont put everything in different messages i cant tolerate the pings
i want know how to get player for who triggered event
wdym by terms?
so like what do you call the movement of car
and modeling the car
what should i google
i googled it
it gives me tutorials on how to setup a plugin
setup a car plugin in a server
the only tutorial i found was 7 years ago ._.
thats an open source cars plugin
what did i tell you about tutorials?
but it uses a bunch of custom things
to never copy paste code?
oh you came, TY
this is my problem
yes. what i told them before is that in programming, you dont just find a tutorial for everything, its about learning to doing it yourself
and you're not doing anything yourself
yea
yea but you gotta base yourself on smth
he can check that code out
see if he understands the logic of it
and recreate it himself
nah reading docs is better than reading codes
theres not always something to base it on...
so i want to know what should i read in the doc
thats what im trying to say
just throwing around ideas, but i would probably start with armor stands
they seem like something you could use for vehicles
yea i get what you are saying, i have no idea how to help him tho, thats why i sent that
ohk
is there a page about that in the wiki?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ArmorStand.html
and maybe this could be of some use as a reference https://www.spigotmc.org/resources/armor-stand-tools.2237/
this looks like a good reference https://github.com/NichtStudioCode/MiniatureBlocks
and this might also help https://www.spigotmc.org/threads/custom-model-data.415216/
Hello, I'm Geegaz ! As you may know, the first snapshots of the 1.14 introduced a new format for the JSON item models custom model data . It's also a...
Okay
Thank you!
also one more thing
what is the command for changing lava at certain cords to air
is it setBlock or something?
should just be setblock ye
are you setting it to air?
yes
but the setblock method is not showing in the tab list
idk what that list is called
the sugestions
oh you mean actual commands, i have no idea
Heya, anyone know why opening a book (right click to read Material.WRITTEN_BOOK) calls PlayerInteractEvent and says the action is Action.LEFT_CLICK_AIR instead pf Action.RIGHT_CLICK_AIR?
Basically, my event listens for PlayerInteractEvent, if the item is a paper or a written book, in their main hand, clicking air, then it takes the custom display name and then parses the lore off of the item they're holding in order to grab coordinates of a location that's imprinted in the lore. Then port the player to said location. However the hang up right now is that when a player right clicks the Written book, it both opens the book to read it AND calls my PlayerInteractEvent, even though i've specified that if it's a written book it should only trigger on left click
https://pastebin.com/sWq4kHNE (Spigot API 1.16.5)
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yea
nice
litebans had a method in their api already
but not for player name
only for uuid
i think i'm sure that i think i found a bug since running the method a tick later still doesn't seem to work
but i'm not 100% sure it is or where i could report it (i'm like 98% sure)
?jira
Is a Custom Chunk Generator compatible with amplified worlds? I can't seem to get the world to let me past the 255 build limit with custom terrain.
let me guess, docs?
no
is there any benefit for using maven and gradle?
they are more confusion than plain java
You can add packages
plain java also can use api
Maven and grade is a great tool if used correctly
they r really confusing
u cant
plugins cant do that
use mods
sad
do you want to download every single jar you use a lib of and have to add it to your plugins on your server?
You can have shaded versions of a plugin in your plugin by using maven and grade
wdym
i added MV api with maven
and uh
i still need the MV jars in the plugin folde
r
Yes because it's a plugin you need to have loaded.
gradle not maven
wdym
if i need the jar even when i have maven then whats the use of maven
That's for Minecraft plugins..
Also Maven / gradle automatically downloads the plugins when you transfer the code to GitHub and copy the code from GitHub
coding together is also easier since y'all don't have to need the same version of every jar using
maven does that for you
me who has no friens
no friend who know coding to be more precise
what?
how?
what is github anyways, isn't it just a file uploading and storage platform?
Oh dear
its not?
Can I get a tutorial for basics of Spigot? Its documented like Oxide... Oxide doesn't have documentation.
if it downloads the plugin when i move it to github then why wont it download when i run it on a server
That's a hard one
true true
There is no basic tutorial for coding
package index
https://hub.spigotmc.org/javadocs/bukkit/ Mr. Rust dev
package index
you should be familiar with docs
Ty
do you code with the game rust of the language
No, the game Rust uses Unity.
Sadly you can't use C# 9.0 methods. So it sucks because you're using 6.0
ooo dunno what 9.0 is
Let's say you use GitHub and you already know what it is. You upload your code to GitHub aka making a repository. Let's say hour harddrive or SSD/nvme drive died. Ok you just redownload the code from github and maven / gradle Will tale care of your dependencies (installing spigot and other stuff)
an insurance huh? Okay
?jd
how? When you download your plugin jar from git, it downloads a spigot server and intellij and the depended plugins for you?
If you set them in pom.xml
i'd rather put it on another drive
Also in pom.xml you can change the version of X plugin with just typing the version
keep coding, stop argumenting. you will see what an automatic build tool can summon from hell once you understood it.
^ try it and you will see it's the best thing ever.
i am using gradle btw lol
Heyo, curious if anyone has any experience with this
hey @quick turtle how do you send a msg to a player?
same as asking why opening a chest gui sometimes triggers right click
your best bet is to set a global ignore variable to true right before opening, back to false right after
then ignore all interact events when the variable is true
gotchu, so how would i go about a global ignore then if i can't check how/when the book is being opened? since i can't see if it's on right click
unless is there a specific event for books being read? (not edited, since this is just a written book)
oh, youre not opening it programmatically
nahh, just default minecraft behavior in game, right clicking to open it appears to call Action.LEFT_CLICK_AIR, rather than anything relating to right click
hmmm
ohhh wait
i think i might have found a way one sec testing
// If display name contains "&4Court Case Document"
// and the Action is left clicking the air only
} else if(name.contains(ChatColor.DARK_RED + "Court Case Document") &&
event.useItemInHand().equals(Event.Result.ALLOW)){
event.getPlayer().sendMessage(event.getAction().name()); // DEBUG
teleportCourtCase(event, main);
}
event.useItemInHand() controls that vanilla behavior
use == for enums
forgot about that, for the usItemInHand
and yeahh will swap it^^ thanks for the help still
HashMap<UUID, Boolean> witch = Witch.getWitch();
Player defender = (Player) entity.getEntity();
if (entity.getDamager().getType() == EntityType.PLAYER && defender.isBlocking() && Witch.getWitch().get(entity) == true) {
return Boolean.TRUE;
}
}```
Missing return statement
on the last }
for some reason
please someone explain
okay
You have to add a else statment
?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.
in the onGrapple method, i want to add a boolean isGrappling, and use it as reference to activate no fall damage in onFallDamage() method
how do i do dat?
you do know you can use && in if statements right?
I will assume everything
wdym?
for some reason, if i add entitydamageevent in the on grapple method, it breaks the plugin
if (condition && condition && condition) {
}
and neither will the grappling work
i know this ofc
use it
ok, so how do i get a reference then?
Make a hashmap
Containing Boolean for each player's uuid
Just set it in the reel event
idk much abt hash maps :(
i know what they do
but...
i have no idea how to do what u just said
HashMap<UUID,Boolean> grapleHook = new HashSet<>(); pretty sure
okey
You set the values of the hashmap in the reel event
tell me this
It's kinda like a arraylist
why do you need a boolean for each one if you can just have a set of players that essentially accomplishes the same thing
you would need a uuid/boolean map if you needed 3 states (not in map, false, and true), but you only need 2 here
Cuz Boolean is the shortest value?
if you can just have a set of players
no the thing is, if the player is grappling, then i want to check it but in another event method
so that will be a boolean
so i can check like if (isGrappling) {
<code>
}
@EventHandler
public void onDamage(EntityDamageEvent evt) {
Entity entity = evt.getEntity();
if (evt.getCause() == DamageCause.FALL && entity instanceof Player) {
Player player = (Player)entity;
UUID playerUUID = player.getUniqueId();
if (lastGrapple.containsKey(playerUUID) && lastGrapple.get(playerUUID).longValue() + plugin.getConfig().getLong("enchants.grapple.fallProtection") > System.currentTimeMillis()) {
evt.setCancelled(true);
}
}
}```
old code, but applicable i think
add the player's uuid and System.currentTimeMillis to a map when they cast
then if sufficient time has passed it won't matter that it's in the map
the one thing you want to make sure is that you remove it from the map when the player quits
yeah that code is fuckin ugly
what i was thinking is, if the player is grappling, i can set him to no fall damage if the damage is below 10 hearts, and if above 10 hearts, multiply by 0.5 and -9
how to do dat, im really dumb
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
first learn java
for a game like tnt run would it make more sense to have the PlayerMoveEvent or a runTaskTimer looping thru the players every two ticks?
Please don't tell me you put that at the event class.
profit
no
i put it above all events class
...
That is not how it works tho..
Hello, i have a lil problem with a disguise plugin i made for 1.8.8
Everything goes good, but the problem is that if I use an original nick from a disguised player on a command it functions normally, which i don´t want to happen because it can betray the disguised player, i don´t know if ia missed something while modifying the player's gameprofile or i have to send other specific packet, can someone help me with this please?
how will it work then?
I'm assuming this has a lot of benefits regarding performance?
Try Bukkit.getOfflinePlayer()
I think it has hasJoinedBefore or smth like that
it´s the same, with vanilla commands too
probably not by much, but it's redundant to check the block if it's not a new one
Gotcha
Also, is nesting scheduleSyncDelayedTask inside scheduleSyncDelayedTask a bad practice?
depends on what ur doing
Let's say for example, I spawn an entity and after 6 ticks I want to kill it
why would u even what to nest it tho
i mean, it's not bad practice.. Don't follow the stupid practices
first know how it works
Well, assume the the entity is part of another SyncDelayedTask
There's nothing wrong with that?
can someone help me in dms?
what do you need?
A sync operation inside a sync operation may take more time because both are sync, but if a sync operation takes place inside a async operation, async operation will make the perofrmance better.
But I won't recommend using a sync scheduled thing, Because it just freezes the thread till its done
i am making a grappling hook plugin, need help for fall protection and preventing fly abuse bits
It's just like saying I did while(true) and server froze.
sushant what are you talking about
of course if you run stupid code stupid things will happen
offline, it's fine to run a task within a task, but i would split it into separate methods so the code is readable
that is nested
i have not the knowledge for that, sorry
then you can call one method within another
I thought Async was depreciated?
no, it will not
why is it called sync then.
so it runs the code on the main thread
that is what im saying?
but unless you run retardedly laggy shit (which you probably shouldnt do at all, main thread or not), you'll be fine
sync operations block the main thread until they are done.
scheduling a sync task for a second from now will not freeze the server for a second
why is async depreciated?
it isn't
I never said for "small" tasks, I told him that if you're doing something big dont use sync.
a whole set of methods is deprecated
yeah, sushant, in my early days i got scared into thinking every single method i ran was gonna lag so i did everything async
it's really not something you should be doing until you start noticing lag from something
but it's ok to do regardless of it being depreciated?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitScheduler.html notice how half are deprecated in favor of the new ones
that's what i mean
Don't use Depreciated method. Javadocs will tell you what to use instead
uh, intresting enough.. but don't tell me u still use sync methods to query into dbs :/
well yeah
obviously you do that asynchronously
he wants to summon and remove an entity
Bukkit.getScheduler().runTask(plugin, () -> {
// code here
}, 1);``` @granite beacon this is not deprecated
and that does it async?
does doing runTaskAsynchronously use it's own thread?
i feel like you guys are fundamentally misunderstanding how these runnables work
I am, please explain
?scheduling
it pushes the code inside to run at a later time, not freezing the existing server processes
so for example:
using runTaskAsynchronously and then using runTask inside of it wouldn't freeze the server if the runTask is something like an external API call right?
Hello
I'm using PrepareAnvilEvent event
and when I'm enchant enchanting book with another enchanting book I will get duplicated enchantments.
@EventHandler(priority = EventPriority.HIGHEST)
public void onAnvilChange(PrepareAnvilEvent event){
ItemStack item = event.getInventory().getItem(0);
ItemStack enchantingBook = event.getInventory().getItem(1);
if(item == null || enchantingBook == null) return;
if(enchantingBook.getType() != Material.ENCHANTED_BOOK) return;
if(!(enchantingBook.getItemMeta() instanceof EnchantmentStorageMeta)) return;
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) enchantingBook.getItemMeta();
ItemStack finalItem = event.getResult();
if(finalItem == null) return;
if(meta.isUnbreakable()){
if(finalItem.getItemMeta() != null) finalItem.getItemMeta().setUnbreakable(true);
}
finalItem.addUnsafeEnchantments(meta.getStoredEnchants());
event.setResult(finalItem);
}
what
add to stored enchantments or normal enchantments based on whether the result is EnchantmentStorageMeta
Hey, how do you start working with NMS in IntelliJ ?
hmm okay ?
I'd show you code that i have for it but it's the middle of the night
?help
*Red V3*
**__Admin:__**
selfrole Add or remove a selfrole from yourself.
**__Cleanup:__**
cleanup Base command for deleting messages.
**__Core:__**
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.
**__CustomCommands:__**
customcom Base command for Custom Commands management.
**__Downloader:__**
findcog Find which cog a command comes from.
**__Mod:__**
names Show previous names and nicknames of a member.
**__ModLog:__**
casesfor Display cases for the specified member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
**__Permissions:__**
permissions Command permission management tools.
Type ?help <command> for more info on a command. You can also type ?help <category> for more info on a category.
Will come back in 10 minutes.
?bt
so how i can create an enchant ?
extends Enchantment
But it ask to add methods
Alright! Thank you!
Make a storage class 😂
There is lava on loc but with this code the lava does not go instead the block under it disappears.
Can someone tell me why this is happening
probably because your y is one too low?
ahh ok
__ - lava
[] - block being clicked to place lava
⬆️ location you are getting
got it
but i tried changing y to (y+1)
it didn't work
is there a command with which i can get the lava loc?
like getLavaLoc or something?
get the lava by using the #getBlockFace method
the blockface. with that you can get the block on the opposite site
i dont want the player to place lava
oh ok
thank you!
so just cancel the event
ohh
if you don't want them to place the lava
whoever asked the question about the saveResource method: did you read the javadocs?
If I do event.setCanceled(true); will this cancel the event forever?
it will cancel the event if its not getting overwritten
i just want it to cancel if certain condition is met
so set those conditions and if they pass cancel it
but after that will the event stay canceled?
yes
can anyone explain how to bukkit scheduler, i have look in the java doc and I still doesn't understand
?scheduling
ty
what do you expect? that after you cancel it it will be uncancelled?
yes
the event is being called everytime someone places lava, water or whatever. if you cancel this in this situation called event it will be cancelled and emptying your bucket will not work. each like-that interaction has its OWN event being called, so it will just cancel the current action
- as long as it meets your conditions
like: setting that if the clicked block is obsidian: cancel
player1 trying to set on obsidian -> cancel
player2 trying to set on dirt -> ok
|| @twilit vector ||
Why do you use saveResource first and foremost
as i just asked you, did you read the javadocs? saveResource is for saving an internal file (which is inside your .jar)
you probably want to playerFile#mkDir
It’s for copying a file from your plugin jar into whatever destination you want it to be.
createNewFile yeah
ah yez yez
You can repeat tasks
what code are you using to do this?
there is no api method to get the servers tps afaik (if they did not add it)
?paste
imma using something like this: https://paste.md-5.net/pifokisepa.java
but it will also receive the smallest peaks
apparently paper has tps methods available. if you are making a private plugin that could be useful
yea i want this
sorry for the late reply i was not at home
that returns a double array
e.setCancelled(true);
e.setCancelled(false);
// ????
no that was a joke
here is the explaination
oh lol
their needs are too great for you to comprehend
ahok
so an e.setCancelled(true) is totally enough
yea
and just cancels this one interaction
Gotcha
so the 2nd time he tries to place a bucket and does not meets the condition then he will be able to place the bucket right?
yes
Has anything changed in the EntityDestroy packet? I use the same code as in 1.16. I only changed how the packet sends
https://hastebin.com/yuvufitoya.properties
https://hastebin.com/awowuneguf.go
condition example
👍
they removed the mapping in 1.17
What does that mean for me? So I don't understand.
Hm something's not right here
public <T extends Enum> T processEnum(String path, T pluginDefault) {
if (!configHas(path))
return pluginDefault;
try {
new DeveloperMessage("AAAAAAAAAAA "+ fileConfiguration.getString(path));
return (T) Enum.valueOf(pluginDefault.getClass(), fileConfiguration.getString(path));
} catch (Exception ex) {
new WarningMessage("File " + filename + " has an incorrect entry for " + path);
}
return pluginDefault;
}
that second return (casting to enum) errors and I am pretty sure it's due to the way I am getting the enum class, is there a better way?
the string itself is correct, I checked
oh my bad? plugindefault is null
I'm being dumb
fuck of course I forgot to set the defaults after I changed the constructors
this has been a nightmare
I'm trying to do some real dumb shit
I was just going to tweak some things and it's already been 5 hours
I want to disable teleportation using the hotbar in spectator mode, but I want to teleport player with gamemode spectator too, how can I do that?
Any way to have like a server that I guess "auto updates / reloads" instead of having to stop the server, build the artifacts and then start the server?
I am pretty sure I have seen someone do something like that before, but I have no idea how they do / did it.
?paste
gaze upon my creation, mortals, and despair! https://paste.md-5.net/ezezeworil.java
no copyright javadoc 

xD
Good morning, I'm developing a server and would like to know which would be the best for performance. Develop my own menu plugin with what I want using InventoryInteract for each menu, or use the ChestCommands plugin

i am not sure what ChestCommands is, but its probably the same if you don't shitten or the plugin is not shit
It would be basic, but I would use many inventory click EventHandlers.
how can i add pattern to a shield if i have something like :
ItemStack shield = new ItemStack(Material.SHIELD, 1);
I wanted to know which one would be better for optimization.
that doesn't matter if you don't do any expensive operations
Basically, check the inventory name on every click.
to know it's the right menu.
https://www.spigotmc.org/threads/1-13-banners-and-shields.345121/ maybe this helps
That's not how your supposed to do that
no no, don't do that
thats a bad way to identify your inventory
What's the best way?
*as long as its not a lobby where a player is much restricted
use a wrapper for the inventory just like InventoryHolder and create a new class for each inventory which implements InventoryHolder
on your check if its the inventory compare the holder with your custom holder
Storing the viewers in a set
thats not a good way of doing it
Works for me
still better than checking the title but nah
do your own thing. why do you want to rely on an already existing resource
its redundant since your plugin would fully depend on it
What I would like to know is if it would be lighter to use multiple click events or a complex gui plugin.
sorry for my english
both are doing the same
every click on an inventory is firing an event anyways
you are just listening for that event
and doing your thing if its getting called
Would you recommend doing a click event for each menu, or checking an instance of it using if else
👀
you could also have like 50+ guis but just one listener which calls the method from the guis what should happen on click
creating a method which is called at the click event. on the clickevent if you identify your inventory just cast it to your inventory and call that method
oh, ok
What set implementation do you use then?
example
yeah for example. but instead of passing every value in, just set the event as the parameter from which you are getting those values
I don't understand how this is going to work. Could you give me an example using this code?
A hash set
Hey, I'm not sure why, but "Skyvival" prints in white bold and not how I wrote it. Does anyone know why it does this, and how to prevent it?
Oh I kinda experienced memory leaks using a normal hashset
That’s why I usually go with the holder way
so you are doing something wrong
Presumably
Could use a weakhashset if you want to be safe
hover over it and see what it says
That's helpful lol
I don't even make my own inventory gui's anymore though
thanks
I just use a lib for it
The wrong is that that a normal HashSet doesn’t clear its elements thus storing a view will be stored forever unless you explicitly remove it which gets kinda troublesome even if you were to do it on disconnect, so eventually I guess a Map Player, InventoryView could do the job also if we don’t want to go with a WeakHashSet.
Anytime you are using the Player as a key you probably want to use a Weak implementation
Yeah or clean up key based caches on that player object on disconnect
Well value based also perhaps
best library I have found for inventories
I use it all the time
Static member 'org.bukkit.ChatColor.BOLD' accessed via instance reference
I have good hopes for interfaces
not too sure what that means
Last time I used something from incendo (the command framework)
it was way over complicated
I hope this is different
Yeah cloud is arguably over engineered if that’s the one you mean
Well bloated might be a more suitable term
I might try it out for my next project to see if it is better than what i'm using now
Oh yeah I might check the one you linked also
@hybrid spoke When I changed it to this, it changed the colour
I hate working primitively around what spigot provides
but not bold
You have to concat them
InventoryClickEvent doesn't detect e.isShiftClick() and e.isRightClick()
Are there alternative?
e#getClick
does spigot plugins work on paper too?
#help-server and yes
Paper is fork of Spigot.
Only paper plugins can't work on spigot.
*if they are using paper related code
right
static instance in your main class and assign "this" to it in your onEnable
Hello,
I am having trouble with Vault API. How can i get Economy interface in other class
Vault forces you to set up the economy on enable
use that created instance
Yes, I added code from vault reference but i cannot use it in other class
Can I DM you code?
class OpenGUI(private val plugin: Plugin): CommandExecutor {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
val econ =plugin.getEcon()
if (sender !is Player) {
cSend(plugin, sender, "no_player")
return false
}
And I want to get economy in third line but IDE show it in red
im a bit confused on how i can do that, can you show me an example?
good old kotlin
public class YourMain extends JavaPlugin {
public static YourMain instance;
onEnable() {instance = this}
}
thankyou
i don't really know kotlin. what does your ide say if you hover it
the delay of .runTaskLater() is on ticks or seconds?
ticks
ticks
Unbsolved reference
Which line
Also idk if you have to but don’t you need to declare that function open?
Also do you need the out there on the array?
val econ =plugin.getEcon()
Yes
Still same problem
Unresolved reference: econ
Okay I see the problem
Try changing plugin: Plugin to plugin: SimpleRtp
Tbh I've never used kotlin
You need in your constructor to declare your main class type instead of Plugin
Yeah Olivo fast guy
Or just inject the Economy instance directly
so i found the canvas plugin for spigot gui's but i dont understand how to install it for intellij, anyone here can help?
Could you link it?
You are a good guy
I am normally webdeveloper in python so I didnt noticed it. Thank you
public class RolePlayCore extends JavaPlugin {
@Override
public void onEnable(){
this.getConfig().set("hello", "world");
this.saveConfig();
}
}```
will doing something like so, create a YML file in the data Directory and create an attr in it called hello and set it to world?
@EventHandler
public void DropItem(BlockBreakEvent e) {
Random ran = new Random();
int BlockDropRates = ran.nextInt(90)+61;
ItemStack blocks = new ItemStack(e.getBlock().getType(), BlockDropRates);
e.getBlock().getDrops().clear();
e.getBlock().getDrops().add(blocks);
}```\
I wanted to get the block that I broke and multiply the drops but when I tried the plugin it wouldn't work the block drops are not getting multipllied but it does drop the block it was supposed to drop just one though
anyone know how to fix this?
I'm pretty sure that list doesn't drop the items in it, you will have to drop them yourself and use event.setDropItems(false);
not sure if this will work. afaik is the block given a copy of the actual broken block.
but also naming conventions
what? could you provide example code?
Um, I'm trying to make "&eSomething" into colors (BungeeCord), I'm curious if I there is anyway I can get this as TextComponent because I still have to setHover and onClick event
i can't. this wasn't a solution. it was a guess. the block you are handling with is just a copy of the actual block which was broken, so you can't set the drops. but i am not sure. could be that i am wrong here.
try the solution @vague oracle just wrote
or
ChatColor is bungeecord api btw
that is in my bungeecord plugin :/
ik but it didn't work
i tried it
or it is due to me, i'll do some debugging and be here
TextComponent.fromLegacyText
is there a way to change the players name above their head without use of packets?
How to pause chunk updates for a particular player and chunk?
E.g when a player loads a chunk, all updates within the chunk (entities, sounds, particles etc) will be frozen.
I have this ```java
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
BukkitScheduler br = plugin.getServer().getScheduler();
Player player = e.getPlayer();
br.scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
player.getInventory().addItem(compass);
}}, 3L);
}
@EventHandler
public void onClick(PlayerInteractEvent e) {
// player
Player player = e.getPlayer();
// see what the player was using and gets the type
Material held = e.getItem().getType();
// gets the action used on the material
Action act = e.getAction();
// checking if the item held is a compass and checking if it is right click on air or block
if(!(player.getName().equals(this.plugin.hunted)) && held == Material.COMPASS && (act == Action.RIGHT_CLICK_AIR || act == Action.RIGHT_CLICK_BLOCK)) {
// getting the hunted player
Player hunted = player.getServer().getPlayer(this.plugin.hunted);
// setting the target to the hunted player
player.setCompassTarget(hunted.getLocation());
player.sendMessage(ChatColor.GREEN + "Now tracking: " + this.plugin.hunted);
}
}``` I don't understand why it is not giving me a compass when I respawn
FourteenBrush, setDisplayName, but that will change their name in chat as well
did you register the events, Nerd?
yes it is
you can't really do that
Scoreboard team prefix
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
this.plugin.hunted = args[0];
Bukkit.getPluginManager().registerEvents(this, this.plugin);
}
return false;
}```
if they are in that chunk
because there is no magical "freeze it" button
why do you respond to random, not-targeted-at-you messages Nerd
just cut the connection
Nerd, why are you registering events in a command
should I not do that? I thought it was okay?
like trying to register them when they cant get executed :/
should I move all of this into my main class or create a listener class?
register it at the start, then just ignore or don't ignore the events based on whether the hunt is currently going on
Main class
main or something
ok
just make sure they're registered in your onenable
I saw in the code BlockDispenser.eventFired but I never see it actually being set, any clue where it is being set cause i don't see it
can I do that with a command like register them even when there is a command something like this? java this.getCommand("hi").setExecutor(new Hi()); Bukkit.getpluginmanager.ect();?
just put in in your main class smh
and instead of bukkit.getpluginmanager... use the instance of your main class
but I need this to activate when the command is run
just register them
in onCommand?
main class 🥺
register them in your onEnable and work with a boolean
so like thisjava public void onEnable() { getCommand("manhunt").setExecutor(new Hunter(this)); Bukkit.getPluginManager().registerEvents(new Hunter(this), this); System.out.println("Enabled"); }
How to get PacketType.Play.Server.WORLD_PARTICLES packet location?
yes
thx !!!
should the vault chat.getplayerprefix return the luckperms prefix is there is one?
i assume luckperms prefix is based on vault
mmm instantiating Hunter twice
set it to a Hunter variable so you only instantiate it once.
Hello I have a question. How can I compile the plugin's source into a jar file when the source doesn't have a pom.xml file?
not
well no, you can I'm pretty sure, but it's kinda the problem that maven and gradle aim to solve
player.getInventory().setItem(0, itemManager.getItem(Item.SELECT_TEAM)); does nothing? I am 100% sure the item is not null
I have pint the item out: ItemStack{COMPASS x 1, COMPASS_META:{meta-type=COMPASS, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gold","text":"Select Team"}],"text":""}, ItemFlags=[HIDE_ATTRIBUTES, HIDE_UNBREAKABLE, HIDE_DESTROYS]}}
i had that before
How did you fix it?
changed it with addItem or something
Ok I will try in survival
Because clearing just works fine
player.setGameMode(GameMode.SURVIVAL); player.getInventory().addItem(itemManager.getItem(Item.SELECT_TEAM));
player.setGameMode(GameMode.CREATIVE);
clearing is different smh
Ok
uhh try that idk
Doesn't work either
just change manually gamemode
Also keeping in survival does not work
Is it possible to cancel all packets within a chunk for a player?
(freeze a chunk)
hi
i made a plugin which gives op items when a player swims, but .... i hav some problems
uhh maybe tell them
gives and error called Invalid Plugin Exception: main class 'me.sam.DD' does not extend javaplugin
extend javaplugin
i did
in my main.java
but it still doesnt work
it was a line of code saying public class Main extends JavaPlugin
😐
Hey, why is that not working? https://hastebin.com/awowuneguf.go
The imports are correct import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy;
I get this error but i dont know why:
https://hastebin.com/enubukiqot.properties
I know about the NMS changes and i think i do all right
java.lang.NoSuchMethodError: 'void net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy.<init>(int[])'
Yes, he cant find the method
No constructor named PackedPlayOutEntityDestroy(int[] intergerArray)
Send plugin.yml
ok
wait
name: DropsDamage
version: 1.0
api-version: 1.17
author: GamingALLday
main: me.sam.DD.Main
description: this is a plugin by GamingALLday
plugin yml
It says the error :/
This are the options:
public PacketPlayOutEntityDestroy(int var0)
public PacketPlayOutEntityDestroy(PacketDataSerializer var0)
1.16
@vague oracle my plugin.yml :
name: DropsDamage
version: 1.0
api-version: 1.17
author: GamingALLday
main: me.sam.DD.Main
description: this is a plugin by GamingALLday
Well did you re-compile it and re-uplaod the plugin?
I can test it again with "public PacketPlayOutEntityDestroy(int var0)" but I am sure it would not have worked with it either
yes, 6 to 9 times
Then you are not using 1.17?
I get the Same error and i use 1.17.1. Maybe because the plugin is 1.17.1 and the server is 1.17 but I can not imagine that. The output of "armorstandb" is "70" and not an int array
Try not using reflection and directly do new Packet..
How can I check, if a player already exists in players?
is anyone experienced in sockets?
https://paste.md-5.net/oxizarotab.cs <- that's how i'm listening/sending but for some reason '→' this arrow is getting sent at the start of the message?
if (plugin.getConfig().getString("players." + playerName) != null)
ok, I'll try it.
How to get location of PacketType.Play.Server.NAMED_SOUND_EFFECT packet
hi there, how can I register custom entity in 1.15.2
i tried to find it on google, but none code was up to date
question
i used buildtools to download spigot
what do i do once i have the .jar file
If you get a chunk by using World#getChunkAt(Location loc), does it then load the chunk for you, or do you then have to run .load() on that chunk?
Check Chunk#isLoaded, if it's false, then call Chunk#load
If you're developing, add the JAR as a dependency, if you're just setting up a server, there's guides on Google
What can cause: Could not initialize class
A lot of things
im using enum for locations
, names
and it can't be loaded
it can but i get: Could not initialize class
Well pretty much tells us nothing
Also why hardcode locations it's better to have them configurable
getWorld is null when that code runs
Make you plugin load post world or load that class later
Or create the location in getLocation
yea
ill try:
won't worn
the error is coming from:
for (Island is : Island.values()) {
how to do that?
add load: POSTWORLD to your plugin.yml
ok
public void onRespawn(PlayerRespawnEvent e) {
ItemStack compass = new ItemStack(Material.COMPASS);
Player player = e.getPlayer();
player.getInventory().addItem(compass);
}
}
```would this give the player a compass on respawn
Try it
It sure would
guys
bc i forgot to do that
i fixed it
with new method
void onEnable() {
after the custom worlds load..
spawn = new Location
ok how do initiate a event
if I don't set a boolean variable is there a way to check that its not set? Kinda like variable == null
boolean isEnabled;
public void enabled() {
if(isEnabled == null)
isEnabled = true;
return isEnabled;
}
how do i put a event in onEnable
primitives will never be null
if you don't set the isEnabled boolean it will return false afaik
I know I'm looking for alternatives to setting a string as true or false though lol
What do you mean?
NVM I figured it out... Just use Boolean instead of boolean
i was about to say that xd
Hey! Quick question: Does anyone know how I can use multifacing on a glass pane that I want to set as follows?:
event.getBlockPlaced().getLocation().add(-2, 1, 0).getBlock().setType(Material.WHITE_STAINED_GLASS_PANE);
Use a Boolean then
It can be true false or null
Or well it can be Boolean.TRUE, Boolean.FALSE and null
I am lol
Aight cool
why not just set it to false at first
until it's enabled
pls help
Because I don't want to check it every time its ran. I only want to set it once
What does this mean? You can only register events in the onEnable, Events have to be their own methods.