#help-development
1 messages · Page 1684 of 1
is there a function that is enabled within log4j that is triggered on a generic message sent to standard out?
the the log4j output seems to be broken into many different types of messages
First off, it's a plugin not a datapack / mod so you need a server to run it. Do this by hosting a local server then put the plugin in that folder or run the server on a vps up to you. Also this goes in #help-server . If you want to code one then I cba.
Oh ok cool thanks
Anyone else have problems with BlockPopulators and 1.17.1? Can't seem to get the populate method to fire.
this is sure a big class xD anyone know where the final built log message could be found in this?
hi, so im trying to set a motd using serverlistping by loading it from an arraylist, but the new line character isnt working, and \n shows up in the motd, whats the fix?
for a warp plugin, how could i get the direction a player is facing *the person who is making the warp * then when a player teleports to that wark they also face that direction?
def more question askers than answer givers lol
bump lol
is 'sql' null? also ur classes should start with capital letters
if they are never initialized they are null
how to?
To get the functions of the classes
Is this in your main class?
bump
no
I have this idea but I'm assuming my execution isn't the best possible
Whenever someone fishes (PlayerFishEvent) I want it to send an actionbar that has random placement that increases and decreases and right now I'm using public static voids and my plan is to use a bunch of if statements and generate random numbers to call those but ik it's really bad and inefficient but it's the only way ik. Any ideas? I also plan to check what part of the actionbars they're on
Show your pluginManager class
although why are you putting them in a different class
What has to happen for the event PrepareItemCraftEvent to be called?
is getMySQL not static?
I'm guessing when all the items are placed in the crafting table to craft it
PluginManager is for getting other classes
I need to start the pluginmanager class to start mysql
hasn't been calling for me tho
also I believe you are gonna get a null pointer when you run it
How do I fix to be able to initialize a mysql function?
seems to be when the item is crafted
https://hastebin.com/faqawofaga.java
If I type /r the following message comes: This player isn't online!
Why? Could maybe someone help me 😄
The player doesn't exist
are they offline?
Your code makes no sense
you store a player object
then you get a new player object using the old ones name?
simple player.isOnline()
isn't that deprecated?
declaration: package: org.bukkit, interface: OfflinePlayer
Not only that, it will never work because you need 2 maps
Im sorry for asking this lol but im awake for like 15 hours now and I want to finish this feature before going to sleep. Could maybe someone just change my code so it works? :c
You need one for sender -> receiver then one for receiver -> sender
Well im telling you how to fix it
so I should simply use if (player.isOnline(target)) {?
okay this makes no sense, im sorry
use your argument
Give me a couple of mins and I can re-write it for you, then you can learn off of it
nah dont spoonfeed, its bad practice
?spoonfeed
@torn vale what are you trying to do exactly?
Im trying to simply program a Essentials Plugin with a /msg and /r command for learning
There is that much wrong with it its going to take ages to help them
but /r doesnt work
ok lemme take a look at your code real quick
I'd have to say /tell is much better
in germany a lot of servers use /msg so I thought it would be a good feature for practice 😄
97% of the minecraft server community uses /msg
ok, just a quick thing, use uuids instead of player names, its easier to fetch a player using uuid
like this:
HashMap<UUID, UUID> map1 = new HashMap<UUID, UUID>();
yea
ok so everything looks alright, except for here
wtf embed
target.sendMessage("§7[§e" + player.getName() + " §7➡ §e" + target.getName() + "§7] " + msg);
player.sendMessage("§7[§e" + player.getName() + " §7➡ §e" + target.getName() + "§7] " + msg);```
there
see that?
the second line>
shouldnt the target and player name be opposite?
no?
oh alr ty
do u mind telling me where in the java docs it says that tho cause
ive looked too
guess im just blind xd
actually i dont see whats wrong with it
hold on wait, what was your issue again?
where there does it say when its called tho
the /r command doesnt work
how do you make a codeblock in the forum?
Click on the "+" > Code
can you be a little more specific?
If I use /msg to send a message to a other player the message gets send to the player. I can answer with /r so I dont have to type "/msg name" everytime
but if I type /r this message comes: This player isn't online!
it doesn't but if you read the methods that it supplies you.
ahhh i see
ty
Whhhhyyyyy
ah i see, try using uuids instead of player names, using player names can get a little fucky
if I use UUID this 4 Warnings will show up
I changed every "getPlayer()" to "getUniqueId()"
oh wait a sec
stil doesn't work
https://hastebin.com/wiqetusuta.java thats my code rn
stone isn't in that list
how to i get the name of a material? its just showing this, but armour and tools are ok
im using material.name()
you get the item's item meta using Item#getItemMeta(), then get the name using the item meta
i did, all null
ItemStack*
Player target = Bukkit.getPlayer(String.valueOf(map1.get(player.getUniqueId())));
if (target == null) {
sender.sendMessage(Constants.PREFIX + "§cThis player isn't online!");
map1.remove(target);
return true;
}
you forgot to it for this one
are you using getDisplayName()?
Try Material$toString
itemMeta.setDisplayName("[" + capitalize(kitName) + "] " + item.getItemMeta().getDisplayName().toLowerCase().replaceAll("_", " "));
i tried
still null
ill try
You’re getting the previous display name of the item if it was a new item it would return null
What's item?
local var of new itemStack made from paramater material
You already tried Material#name() right?
yes
Set<Character> set = Set.of('a', 'b', 'c');
// If set doesnt contain
// ! == not
if (!set.contains('d')) {
}
works on bow and armor and tools, not arrows and golden apples
its wired like that 😦
i also tried Material.getDisplayName()
What’s the issue
the names of items and food return null, but items and armor return their name
not null on armor and items
getDisplayName will be null unless you have done setDisplayName at some point
so how do i get a static name from mc?
There is Material.toString which will return the enum name
that returns null
And I thin ItemMeta.getLocalizedName also exists
ill try localized
Material.toString cannot be null unless material is null
In which case you would get an error
anyone know how to get a custom models data?
like get an items model data from in game
You could easily make a plugin for it
help?
There might be a way with the in game commands, I’m not super familiar with them
What line is 87
PluginManager.getAccount().saveData(allData.getUUID());
I'm trying to make a custom fishing system which is going swimmingly (pun intended) but my issue is that the player can catch regular fish still. how do I prevent the player from catching any fish?
There is a PlayerFishEvent
Even with return, will the code still be generated every 10 minutes?
How do I use the worldguard api to check if a player is in a region by name
Yes
Calling autoSave once with the if condition not met will make the code keep running on a timer
@young knoll the Material#toString is not working, and getDisplayName is not working, and Material#name is not working, and i need a way to simply get the name of an item!!!
Could someone say me why my code doesn't work?
Thats my MsgCommand Class:
https://hastebin.com/imevewesur.java
Thats my Main Class:
https://hastebin.com/ehoqocumud.java
Thats my Constants Class (I think you dont need it):
https://hastebin.com/usoxovojat.php
Thats my plugin.yml:
https://hastebin.com/ogacemetuv.http
(I know the code is kinda crap)
Only the /r command does not work, the /msg command works just fine 🙂
not what i meant
cancelling player fish event would cancel throwing the bob
i want the player to throw the bob BUT also not be able to get anything
I want fishing to be dealt with by my plugin
its for custom fishing
i think there is an event for when the player catches a fish, just cancel that
declaration: package: org.bukkit.event.player, class: PlayerFishEvent
if (event.getCaught() instanceof Fish)
hmm ok
wait but what if it's not an instance of fish?
the player will still get other loot right?
yeah
check if its not null @paper geyser
just look at the docs and see what you wanna do
declaration: package: org.bukkit.event.player, class: PlayerFishEvent, enum: State
ahh alright thanks!
How do I make a EntityPlayer body rotate?
Right now I'm using:
final float[] newYaw = {npc.getEntityPlayer().yaw};
Bukkit.getScheduler().runTaskTimer(getInstance(), () -> {
newYaw[0] += 7.5F;
EntityPlayer entityPlayer = npc.getEntityPlayer();
for (Player player1 : npc.getVisibleToPlayers()){
PlayerConnection connection = ((CraftPlayer) player1).getHandle().playerConnection;
connection.sendPacket(new PacketPlayOutEntityHeadRotation(entityPlayer, (byte) (newYaw[0] * 256 / 360)));
}
}, 0, 2);
But the following occurs
holy shit that's creepy lol
lmao ik
iirc EntityPlayer does have a method for body rotation 
Having an issue with the attribute system
that's what I was thinking 😢
I thought it was client sided
Well it would be a mix of both
Sends debug message but has no change
Has no change for Generic_movement_Speed but works with health 🤔
is it bad idea to save world to mysql? xD
yes
well hypixel used to store housing plots in an SQL database
doesn’t mean it’s a good idea but it worked at scale for some time
it's fine to store .mca files
it's not to serialize a whole world objec
what is .mca file?
region file
you can just literally write the contents as a blob, but saving huge files into a sql database isn’t exactly a good idea
consider saving the world a file system instead or use something like amazon S3, and store the URI to the world in the database instead
you could always store it as a schematic and load/unload it
small file space and with FAWE it shouldn't be too hard to load/unload
What I do is like
omg i should set my profile image
ohh
is this your plugin?
my saving methods call a void(File[] savedFiles) once they're done saving
the IslandData stores a reference of those files
And it all gets serialized at once
not the best but it works
wait that will cause outofmem error
not really
but
one thing I realized is like
I should store the byte[]'s along with the files
just storing the files probably won't work
as a file is just a fancy path to a real file in the file system
ok its compliczted
basically my code does the following
OnLoad -> query database -> store file in a temp location (world or cache schematic) -> load file
OnSave -> save file -> grab contents -> save to database -> delete file
do i hhave to set sql query max length higher?
set it as mediumblob
i mean as i know, there is max query length
FAWE stuff probably
umm
FAWEHandler
hmm
Is there a way to backup server files that are in game and not in the files? Cause we lost all our files and there hasnt been a restart.
So can I execute a command within the console to save everything in the game loaded
loaded data is usually on the world folders
But what you basically want is to save all data loaded in RAM
worlds auto-save and whatever
The region folder contains all the blocks, entities, states
the playerdata folder contains all the player data (inventory, attributes, enderchest, position, world etc)
I'd just recommend you start backing up the world data automatically
preferably on a cloud service
It's a bad idea to do that in the first place
saving the world is the equivalent of doing that
Well at this point we lost about tons of paid plugins, hard worked worlds and much more. So I would like to know anything that can help us towards the fix
Paid plugins can be re-downloaded on spigot
I realize that, but I want to know any possible way we can do it
How would that work
when you delete a drive you just delete file pointers
they just remake the pointers and whatever
but really there's no way back I believe
There are probably a bunch of tools that can look for deleted stuff
that too
But if any of it’s been written over you’ll get corrupted data back
Or you need to resort to expensive recovery services
Get a backup system
Is that a server command or OS command
that isn't a spigot/paper/whatever command
When I executing this command… will it give us the files bassicaly?
Looks like it’s for copying files from one drive to another
Doesn’t look to be related to live RAM
I mean you should have had backups
If the world is still running you can force a save-all for the world files
But nothing like that exists for plugins afaik
how do i detect if a player causes damage to a mob
Listen to EntityDamageEntityEvent
ohh got it
and how do i check instances of mobs like...
}```
i want to detect if a cat is hurt
where is the part that saves schematic to mysql?
the StorageHandler
.
I just serialize the entire object
Yeah just get the byte[] and save it
Then you create a temp cache file, write the byte[] to it and load it
that's one thing I did wrong and will fix eventually
hmm ok thanks
How do you make frosted ice that ages and doesn't leave water behind?
Trying to do this tutorial: https://www.spigotmc.org/wiki/creating-basic-command-functions-in-bungeecord/
My Lobby class don't seem to work. Any ideas?
package me.chainsawninja.chainlobby;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
public class Lobby extends Command {
public Lobby() {
super("Lobby");
}
public void execute(CommandSender sender, String[] args) {
if ((sender instanceof ProxiedPlayer)) {
ProxiedPlayer p = (ProxiedPlayer) sender;
p.sendMessage(new ComponentBuilder("Connecting you to the lobby!").color(ChatColor.RED).create());
p.connect(ProxyServer.getInstance().getServerInfo("lobby"));
}
}
}
I get the error
"package commands does not exist"
when calling it
ProxyServer.getInstance().getPluginManager().registerCommand(this, new commands.Lobby(this));
new Lobby()
what do I need to import to use
player.getServer()
When is plotsquared being updated for 1.17.1? Literally just bought it and didn't realise it is not supported Nevermind, stopped getting errors now for some reason
a radial search
dude i never know what to import x.x
what IDE do you use?
ProxiedPlayer, no?
that sounds like a bad idea
what if you toss it in the middle of nowhere
it’s guaranteed to have one within 10 blocks
Then I suggest you get chunksnapshots and do the queries to them async
just do a radial search, you are only checkign a 10 block radius
how lol
or be lazy like me
do a top-bottom search and sort by distance
Since chunksnapshots exist now
We can do them async
1 thread per chunk, add up all the results
and bam performance
I guess it depends on how often you need to search and for how many players
a snapshot probably wouldn't work in this instance as you can;t assume you have 10 blocks in either direction. You'd have to snapshot 4 chunks each time and the overhead of that may negate any performance gain you get from searching async.
however, reading data async is generally fine when reading blocks.
I've never had an issue with it. Changing anythign is a no no though
or you can ignore snapshots all together as you are only reading, and just search async
(locationx - 10) >> 4 etc
you still have the overhead of creating "up to" 4 chunk snapshots
You can't change anything async, but reading seems to be fine.
wish there was a way to cache a chunk section for that extra perf
can't bother reading spigot code that does it
I guess it depends on your use case again
is there a way to ignore the limits of each tool. Like I could ignore it and a shovel would break stone at the same speed as a pickaxe
what's the event for right clicking? i can't find it on javadocs (i'd prefer to use the "block place key" event as i have my controls inverted)
PlayerInteractEvent?
i'll give it a look on javadocs, i'm new to this 😆 only done python before
Oh yeah, recommend you look at some tutorials on YouTube
i have 😄
https://www.youtube.com/watch?v=_DScPFkf7JM&list=PLfu_Bpi_zcDNEKmR82hnbv9UxQ16nUBF7&index=5 this one (it's a series)
thanks 🙂
Does anyone know how this packet is called? It might be PacketPlayInFlying or smth but idk and currently on shitty laptop so I cant test 😅
maybe im dumb, but
public class LobbyGo extends Command {
public LobbyGo() {
super("Lobby");
}
public void execute(CommandSender sender, String[] args) {
if ((sender instanceof ProxiedPlayer)) {
if (sender.getServer().getInfo().getName().equalsIgnoreCase("lobby")) {
sender.sendMessage(new ComponentBuilder("You are already connected to the Hub!").color(ChatColor.RED).create());
return;
}
ProxiedPlayer p = (ProxiedPlayer) sender;
p.sendMessage(new ComponentBuilder("Connecting you to the lobby!").color(ChatColor.GOLD).create());
p.connect(ProxyServer.getInstance().getServerInfo("lobby"));
}
}
}
doesn't work, and I have tried everything. it just doesn't like "sender.getServer()"
nvm, fixed lol
put "ProxiedPlayer p = (ProxiedPlayer) sender;" first and used that
for(Player p : Bukkit.getOnlinePlayers()){
String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
if(rankName == "PLAYER"){
Bukkit.broadcastMessage("e");
}
``` this does not work and i don't know why , it seems to be when i check if the rankName is equal to something , the yml file is structured like
Players:
dc2bb58d-743e-461a-9809-258a455ac280:
kills: 0
deaths: 0
rank: PLAYER
use "PLAYER".equals(rankName)
Two strings with the same content may not be of the same object
Also it should probably be Players. instead of Players..
i can't seam to find out how to do this, anyone here know?
public void onPlayerInteract(PlayerInteractEvent e){
ItemStack block = e.getItem();
System.out.println(block);
if(block == Material.BOW) {
System.out.println("clicked with a bow");
}
i think you can see what i'm trying to do 🙂
Nope I can’t see
thanks conclure , it works
if the player right clicks with a bow then it'll send a message in console saying they clicked with a bow (i know this has no use yet, at some point it will)
Make sure the action is RIGHT_CLICK_BLOCK or RIGHT_CLICK_AIR as well, otherwise you will get when players step on pressure plates and whatnot as well
Also, do you have an @brave glenHandler above it?
ughh
Accidentally pinged someone lol
yep i do
lol they must get pinged all the time
listener is registered?
Oh, so is something not working?
yea
oh
duh
I'm sorry I missed that
Check the itemstacks type
ItemStack#getType returns an ItemStacks material
The PlayerInteractEvent class has a method called 'getAction' which returns a class instance called 'Action'
ah
You should, more or less, be able to check if e.getAction() == Action.RIGHT_CLICK_AIR
thanks 🙂
My pleasure 🙂 Good luck
thanks!
How can i make a directory with my Plugin?
Depends on whether you want to NIO or IO. The first is more modern and uses Path instances, the second is older but a bit more object-oriented
ok thanks
How would I give an entity (TNT) some acceleration/movement?
like after spawnEntity(TNT)
get the entities velocity, change the vector, then set the entities velocity
uhh
getVelocity should return a Vector object. Store that to a variable. Use the multiply method on that or set methods on that. Then use setVelocity on the entity back to the cached variable
got it I think
Granted, multiply on a velocity of 0 will give no effect lol
Yeah, you can add to it
so how would I get the velocity of it
Entity should have a getVelocity method
and spawnEntity should either return an Entity, or you can provide a Consumer that takes in an Entity. (could just use lambda)
I really have no idea what the means (I know your really trying but I'm new)
Entity entity;
Vector velocity = entity.getVelocity();
velocity.setY(2);
entity.setVelocity(velocity);
Thank you this makes so muck more sense
Do you have programming experience from another language?
Got it. So practically the same syntax due to Oracle not selling out to Microsoft lol
C# is pog tho
ye
Anyway, when I say Method, you may think of a function. Not technically the same, but ya know.
When I say "Entity should have a getVelocity method"
I am referring to the Class Entity having a Method called getVelocity
ik that
I realize I could've been more clear with the instructions as a whole
"get the entities velocity, change the vector, then set the entities velocity" isn't quite
understandable to someone who doesn't know the methods
my problem was I was being super stupid and idk what I was doing but I wasn't even using the Class Entity
I was just doing player.getWorld().spawnEntity(player, Entity.TNT)
soo after it I do return Entity?
no
ok
spawnEntity is a method of World that returns Entity
Think of it in terms of
public Entity spawnEntity() {
return brandNewEntityYeetYeet;
}```
The World#spawnEntity method returns an entity
So you would use it like
Entity entity = player.getWorld().spawnEntity(```
if(!(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
if(p.getItemInHand() == null) return;
if(e.getItem().getItemMeta().equals(ItemManager.statisticBeacon.getItemMeta())){
Stats.showStatsGui(p);
p.playSound(p.getLocation(), Sound.CHEST_OPEN,1,1);
}
This does not seem to work even though it should
To my knowledge... ItemMeta doesn't override .equals() so it's just comparing instances directly
Keehl im going to dm you a screenshot
e.getItem().isSimilar will compare ItemStacks including meta
Good call
ok , it still does not do anything
may I ask what u r trying to do
just use event.getItem().isSimilar(ItemManager.statisticBeacon)
comparing the stacks content without amount
And if you put debug or something in prior to the similarity check, the debug fires?
Hello, i did a simple plugin but i want to do a file for change the message, could anyone pass me a guide or something like that
pls 😄
for some reason it cant send the playerinteract event probably when i try to show the gui
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.
this makes no sense
at line 131 i check if it's null
why tf does it return a NullPointerException
jda is null
is jda null?
yeah
you're calling getGuildById on it when its null, which throws NullPointer
in all fairness, old NPEs are fucking annoying
in newer versions of Java you can see what's actually null tho, which is nice
not like I work in anything besides Java 1.8
^ I always use Java 16 when possible
Well, I use Kotlin so versioning doesn't matter. It's better to get compatibility.
I'm bad at using new features though
And Kotlin doesn't need the fancy NPE messages of newer versions, since it's a null-safe language.
Any? -> Any? (:
listen here buckaroo
Any? is good for one purpose:
a value representing anything, even null
but should not be used in many contexts
the main one I can think of is println
that's just bad
Fuk unit
why would you even use a boxed primitive in Kotlin
And mutable (:
I have no issues with mutable lists
mutability doesn't give me heart attacks bc I'm not concurrent
Oo not one of those mutability haters then pog
listen there's this one library that would be better if it was mutable
Which is?
This thing is great! But I fucking benchmarked it and oh god.
I like functional code, a'ight?
Lol yep
Benchmark Mode Cnt Score Error Units
Main.standard_library thrpt 25 14.163 � 0.202 ops/s
Main.vavr thrpt 25 0.828 � 0.015 ops/s
It can't even perform one operation in below a second.
ItemStack other = new ItemStack(Material.PAPER);
ItemMeta otherMeta = other.getItemMeta();
otherMeta.setDisplayName(Utilities.color("&3&lStatus &r&7(" + p.getName() + ")"));
List<String> otherLore = new ArrayList<>();
lore.add(" ");
lore.add(Utilities.color("&7∙ Online: &aTrue"));
lore.add(Utilities.color("&7∙ K / D: " + KDR));
lore.add(" ");
otherMeta.setLore(otherLore);
other.setItemMeta(otherMeta);
The lore does not appear
All of its methods create a new List
🥴
It's safe for concurrency, sure, but you lose out on any benefit that concurrency would give you when it can't even run a single operation in less than a second.
My benchmark code (not perfect, but they do the same thing I'm sure):
Yeah that’s probably one of the better reasons to have stuff immutable
.
what're you doing with other after that?
can you show me the code from Utilities.color?
I'm just curious since I can't see much wrong with it
return ChatColor.translateAlternateColorCodes('&', msg);
}
my github is there for the sole purpose of looking like i know github , i don't
nice catch
check out GitHub Desktop, it's pretty simple to use
do you have a lore list or smthn? lmao
I'm pretty sure it wouldn't even compile without one
?kick 421921261996867585 emote spam
Done. That felt good.
how do i do cooldowns? i have done the code below but the cooldown doesn't work
public class PlayerInteract implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e){
Map<String, Long> cooldowns = new HashMap<String, Long>();
ItemStack coalOne = new ItemStack(Material.COAL); //making a hashmap of 1 coal
coalOne.setAmount(1);
Player p = e.getPlayer(); //getting the player
if (cooldowns.containsKey(p.getName())) {
//in hashmap
if (cooldowns.get(p.getName()) > System.currentTimeMillis()) {
//still has time left
long timeleft = (cooldowns.get(p.getName()) - System.currentTimeMillis()) / 1000;
p.sendMessage(ChatColor.RED + "You still have " + timeleft + "s left");
return;
}
}
cooldowns.put(p.getName(), System.currentTimeMillis() + (5 * 1000));
if(e.getAction() == Action.RIGHT_CLICK_AIR) {
if(e.getItem().getType() == Material.NETHERITE_PICKAXE) {
System.out.println("clicked a netherite pick");
if(e.getItem().getItemMeta().hasCustomModelData()) {
if(e.getItem().getItemMeta().getCustomModelData() == 1) {
System.out.println("you r-clicked an item with custom model data of 1");
if(p.getInventory().contains(Material.COAL)) {
p.getInventory().removeItem(coalOne);
e.getItem().addUnsafeEnchantment(Enchantment.DIG_SPEED,7);
}
else {
p.sendMessage(ChatColor.AQUA + "You don't have any coal. can't speed up!");
}
}
}
}
}
}
}
Your Map is a local variable inside your event. It only last for the duration of the event.
so do i have to define it outside of the event? like in the main class
in teh same class, just move it outside the method
k 🙂
how can i do to update the config.yml with a command?
i mean
to set if is true or false
you get the path and then set it , lets say i have the section funny: in my config.yml , its set to false by default but i can change it to true by doing getConfig().set("funny", true); and then saving the config
hey! how could i scan a chunk, then retrieve it's blocks into a list that can be used later?
Main plugin;
public Message(Main inst){
plugin = inst;
}
@EventHandler
public void chat(AsyncPlayerChatEvent e){
Player p = e.getPlayer();
String message = e.getMessage();
String prefix = Ranks.getRank(p).prefix;
if(plugin.getConfig().getBoolean("useCustomChat") == false) return;
e.setFormat(Utilities.color(plugin.getConfig().getString("chatFormat").replace("%rank%", prefix).replace("%player%", p.getName()).replace("%message%", message)));
}
for some reason it does not work
the format
it just does not work
no errors
Why did you using if config.getBoolean == false
Lmao
Just set if (!cfg.getBoolean(...))
Don't use e.setaformat for that
use e.setMessage
Or e.setCancelled and send message with your method
Did you registered the event listener
no errors , i get
<PLAYER Hockus> the message but not what it was supposed to do
yes i did register it
yes
no
my config boolean is set to true by default
Google your question before asking it:
https://www.google.com/
wait does nms 1.17 work for .1 ?
Hello, I'm trying to figure out how to add a sword into a chest if there aren't any in it. I've tried all the solutions I could think of but it is still not working, could you help me? ```final ItemStack sword = RandomUtil.nextItem(itemStacks);
boolean isSwordInChest = false;
for (final ItemStack item : inventory.getStorageContents()) {
if (item != null) {
final boolean isSword = item.getType().name().contains("SWORD");
if (isSword)
isSwordInChest = true;
if (isSwordInChest)
break;
else inventory.addItem(sword);
}
}```
The chests keep getting filled with swords
yeah , i don't even think its firing
i removed the check for boolean and it still does not work
ok , so it does work but the format does not change anything
hey i have a line in my custom item plugin
private static void createWand() {
and
private static void createDiamondWand() {
now what does the createDiamondWand mean??
why are you asking us
no like i am making 2 custom wands and one of them starts is createWand and the other is createDiamond wand soo will both of these be diffrent item or not
its just the method name
actually technovision's code
coding tutorial guy
I've tried using the contains method before but it wasn't working either.```final ItemStack sword = RandomUtil.nextItem(itemStacks);
for (int i = 0; i < inventory.getSize(); i++) {
final ItemStack item = inventory.getItem(i);
if (item != null) {
final boolean isSword = inventory.contains(sword);
if (!isSword)
inventory.addItem(sword);
}
}```It isn't working because I need to check if the chest contains multiple different types of swords. I'm trying to see if the chest contains any of the items in the itemStacks list.
I didn't think of that, thanks a lot I'll try it out.
hello again other question if u want to add a command to get an item do u have to use @Override on the start of each command or just once and type the other code
probably
hold on , it actually has an error
are u talking to me
wait can i send it here
i am a retard , i was using a custom yml to store messages my bad for wasting your time
btw i couldnt find anything
idk how to like
pretty much i have problems getting on how to start it
i still need help, pls (1 more bug below message)
Caused by getting the display name from the itemstack rather than the item meta
jeje
are you aloud to do external link payments? (payments not through spigot)

alright thanks
the main way of payment should be allowed on spigot thru paypal
you can allow them to use paysafe and add them yourself
alr
bump
Freestyler long time no see x)
hey there 😄
ignored by conclure. ouch
Nonoonon
Hey, i have 2 commands registered in plugin.yml but when i put the commands in minecraft it doesn't appear nothing, maybe i have them bad registered or something like that?
Did you register them in the onEnable
what would be the best way to give players a reward after an hour online time?
i dont want to use a runnable
ig i have a command in the same section that works
do i send you the code?
You're gonna have to use a Runnable at some point, even if it's to check a Statistic for play time.
Could check PLAY_ONE_MINUTE Statistic, once it hits 72000 (ticks in 1 hour), reward them
But you still need to have a Runnable checking that
I've been working on a new core for my minigames :D
Why not
so a runnable that checks every minute?
That would work, yeah
Team owner = scoreboard.getTeam("1");
Team player = scoreboard.getTeam("6");
people in owner team would be higher in the tablist than the people in players right?
pro bably
well i added people to teams but it does not seem to prioratize me in the tablist
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
Team owner = scoreboard.getTeam("aOwner");
Team player = scoreboard.getTeam("gPlayer");
if(owner == null){
owner = scoreboard.registerNewTeam("aOwner");
}
if(player == null){
player = scoreboard.registerNewTeam("gPlayer");
}
for(Player p : Bukkit.getOnlinePlayers()){
String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
if("PLAYER".equals(rankName)){
player.addEntry(p.getName());
}
else if("OWNER".equals(rankName)){
owner.addEntry(p.getName());
}
}
I have been trying for a while but players still have higher priority than me for some reason
reverse the numbers
what numbers
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
Team owner = scoreboard.getTeam("aOwner");
Team player = scoreboard.getTeam("gPlayer");
if(owner == null){
owner = scoreboard.registerNewTeam("aOwner");
}
if(player == null){
player = scoreboard.registerNewTeam("gPlayer");
}
for(Player p : Bukkit.getOnlinePlayers()){
String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
if("PLAYER".equals(rankName)){
player.addEntry(p.getName());
}
else if("OWNER".equals(rankName)){
owner.addEntry(p.getName());
}
}
nothing?
it still does not work my god
to override the same listener from a plugin do i need to set the priority to high or low?
nah, it wouldn't have the final say then
to override worldguard :/
.
if i want to add DPS for my custom mob, do i need to fudge with their NMS?
uhm ugh if i call a method in the oncommand, which returns true, does that stops the command?
Why would calling a method that does anything affect the actions of onCommand?
i havent really thought about it
can anyone help, how can i put my members playtime on my smp like it shows on the tab list next to their name
i use the worldguard api in my plugin, tmcsumo, and on some servers i get this tracktrace which i don't understand at all. could this be caused by an outdated luckperms?
"not supported yet"
.-.
how can i do to push some player upwards?
problem is why is hasPermission not supported
and why does it work on some servers but not others
What the ...
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.entity.Entity org.bukkit.World.spawnEntity(org.bukkit.Location, org.bukkit.entity.EntityType, boolean)'
Binary incompatibilities, what server version do u use
And what version do u build against
1.17.1
uhh i read this and i want to uncancel the event if it has been cancelled by worldguard so isnt it the highest priority?
When changing values of an event the changes of one with the higher priority will override any changes done before by a listener with a lower priority so that in the end the one with the highest priority can have the final say in the actually outcome.
Both 🤷
your server is probably not on the latest version
it's not latest build but it is 1.17.1 🤔
rebuild your server from latest and also nuke your local maven/gradle depdency of spigot
yea but spigot introduces new API in 1.17.1
pretty sure some pr got accepted that yeeted some of the spawnEntity methods very recently
Who here has experience with the nms pathfinding and navigation system?
Because I need some assistance
From my experience.... Will never try again 😦
Well, I already reimplemented everything to properly annotate, deobfuscate, document and actually make it readable
Yet I am still lost
The most success I had was I made zombie not attack players 😂
I see, There are no more spawnEntity method in the Spigot doc 🤔... What is the new way to spawn entity?
there are. They just moved from the World interface to the RegionAccessor
Oh, I am not talking about goals
I was using spigot-api to make my plugin work on other versions 🤔 so they made it incompatible
I am talking about fucking with the underlaying system
nah it should still be fine
you are just using a method that your server does not yet know of
update your server to the latest of 1.17.1 and you should be fine
/particle largeexplode ~ ~ ~ 2 2 2 2
How do I convert this in code? Couldn't find anything in the docs with delta x, y and z in spawnParticle().
declaration: package: org.bukkit.entity, interface: Player
so if i remember correctly and i have worldguard listening for an event on EventPriority.HIGH and i want to uncancel the event should i use EventPriority.HIGHEST or LOWEST?
HIGHEST will be first then HIGH and so on
You need NORMAL or lower I think
highest will be run second to last
and is your best bet if you are overwriting/undoing other plugin modifications
I was using "getPing()" for a function, but it doesn't update post connection. Anyway way to update the ping?
so highest?
bump
Im setting a slimes velocity to (0,-3,0). How would I do something once it reached the ground? is there an event that gets called when something hits the ground? (except the EntityDamageEvent)
Salam jenap
😐
Salam bar jenap digar
xD
Alan mian ban midn XD
Hey guys do we have any path finder that custom entity move to special location. ?
Hello everyone i just started looking at spigot and the event. I would like to set a glowing Potion effect to a sheep when i shear it ... but i get an Entity from the Event so ... how can i get a living Entity ?
Nope. You need to find a workaround like the EntityDamageEvent
are there ways to get damaged by your custom made entity for lets say, every 10 ticks?
What do you mean by "damaged by your custom made entity"
Do you want it to attack someone twice a second or just a general AOE dmg?
gen AOE dmg
like a DPS
have you ever fought hypixel skyblock zombie slayers?
like that
they do certain damage every second
hypickle 🤮
Get all entities in a radius. Filter them. Damage them.
How you schedule this action is up to you but you should def abstract
a lot here.
alright thanks mate :)
alright
can i have more than 1 event in 1 class?
how it works
calculating the speed of a projectile falling on minecraft
pls help me i've asked like 5 times already (1 more bug below that message)
oh so i dont need to make each event in seperate class?
I suggest creating a thread, makes it more conspicuous to everyone
for some reason my plugin can't connect to my database unless i manually log intro it first
i wonder why no one's helpin lol
(that was sarcasam)
i actually thought everyone just hates me cause i called them out for being toxic
anyways i didn't try because i don't know what's going on in my own plugin lmao
i have no clue how to fix it
or where to start
btw how can i make it in seconds
wdym?
that can break
int secondsLived = (int) entity.getTicksLived() / 20;
its a boss so it lasts for like 7 mins
how many ticks are in 20 milliseconds
1/3 of a tick
Are you sure about that
What event could I use to get the y level of a player?
getlocation
and it's not tied to a specific event
it's an entity method
like player
No i want to listen for when the player hits a certain location
so um can anyone help please?
@quaint mantle moveevent
and its getTo
simplify it with block change checks
if getfrom block is same with getto block then don't do anything
If i want to teleport a player should I use event.getPlayer().getLocation().add(0,200, 0);
just use the teleport function lol
thx
Whats your prob?
this is the updated version of my problem:
code for the events of the gui: https://hastebin.com/damuwayave.java
bug 1: when i put a recipe that is not just 1 item i have to click an allowed slot in the gui to update it and only then it puts the result in the result slot
bug 2: after i do bug 1 and take the item from the result slot it will remove 1 of each item in the crafting grid, let me take the item but then it will put another one in its place, then if i take that one it will just give me another one and disappear from the result slot"
I see. What spigot version?
you mean minecraft version or...?
Yes
1.17.1
ok
Lets start by making this code a bit more maintainable and performant.
if (!(e2.getSlot() == 11 || e2.getSlot() == 12 || e2.getSlot() == 13 || e2.getSlot() == 20 || e2.getSlot() == 21 || e2.getSlot() == 22 || e2.getSlot() == 29 || e2.getSlot() == 30 || e2.getSlot() == 31 || e2.getSlot() == 24)) {
This should be replaced by a
private final Set<Integer>
in your class on which you call contains(int) on.
Pls change this and re-send the class.
what
everything
Listen up, Derpy
This code is bad.
Not only is this slow, but it's hard to read and update in the future.
read his message
It's not very hard to change this to something that works better.
???
????????????????
You need to create a new set
morice if you're not gonna be helpful please stop being toxic
private Set<Integer> set = Sets.newHashSet();
scratch that, just stop being toxic all together
A set is a collection of values
Y'all just let me explain this concept to him. He won't understand your code lines.
Java has many different "collections"
- List = Contains a list of values that can be added to and gotten from via
addandget - Set = Contains a list of values that can be added to but not gotten from, only iterated, like with a for-each loop.
- Map = Contains pairs of values, where you can get a value from another value and put new pairs in with
putandget
public boolean isValidSlot(int slotID) {
if (slotID == 10 || slotID == 11 || slotID == 13) {
return true;
}
return false;
}
To
private static final Set<Integer> VALID_SLOTS = new HashSet<>(Arrays.asList(10, 11, 12));
public boolean isValidSlot(final int slotID) {
return VALID_SLOTS.contains(slotID);
}
Set is best for this since you won't need to get a specific number, you just need to see if the Set contains a value with the contains method.
a variable outside of a method i think
Yep, it's a variable belonging to a class.
You need to create a new field in your class where you check the slots.
And that field needs to be a Set
ok, can you dumb down what a Set is?
bruh
...again...
its a collection of data
A Set is a collection of values where you can only add to it, not retrieve from it.
this
but i need to get stuff from the collection
You actually don't.
then how would i do that if i can't
i THINK u can do this
Your Set should contain all your slot numbers.
i dont use sets very often
And the fun thing about Set is that you can check if the Set contains a value.
List::contains 😄
Conclure, I know.
ffs y'all stop fucking interrupting me
too lazy to make it
And we aren't using List bc you don't need to retrieve the value.
can someone help me?
vro this is a text chat
Checking if Set contains a value is different from retrieving a value.
Since you can use mySet.contains(value)
you can use List.contains as well
casting int to int 😕
Yeah but List is less performant
bro
what's wrong with my current one doe ):
what
this makes 0 sense
Set uses hashes iirc
you makin a variable for dis, i dunt
the point is you do not need a list
List uses an array (if you're using ArrayList)
call me crazy but less variables equals less lag
a HashSet, yeah
???
tru in a sense x)
the problem is your code is rigid
THIS IS WHAT I MEAN BY STOP FUCKING INTERRUPTING ME
what's rigid
code smell basically
AAAAAAA
i understand you're helping in good faith but you need to calm down dude
ur application is like a pussle entangled
lose the "i am better than all of you shut up you can't help people" attitude
yw
can some1 help plz ? how it works
calculating the speed of a projectile falling on minecraft
yee
Gotta get the slope
there is no reason to make this place more toxic than it already is
what is the issue?
I mean every time it starts to fall it goes down faster
i need to do something similar to minecraft perspective camera
is not something necessarily an entity
??
ah, so if the entity gets killed in under 60 secs, make it say just the seconds, if its killed in over 60 secs, make it say minutes AND seconds
suppose we have a cartesian graph
where are the x, and y axes of the player's camera
mk
in this case, I'll apply a force at +5 on x
the just seconds part is already made
then have an imaginary ball or a square something to represent the point where it's going ''the entity''
so, is there an actual problem or
idk how to write the int for the minutes and seconds
and as if it were the player's minecraft perspective camera, I intend to create a code recreating this scene
can be too
TimeUnit maybe (like if you want to convert)
?
yes
is it a java thing or spigot thing?
i need to make a player's camera move slightly in the other direction like minecraft camera perspective 😌
timeunit is java
aight
unfortunately im not sure this is actually possible in the sense you are describing
f
i mean i guess how i would do it
its possible chaning the position of the camera of player
why do you wanna change it in the first place
the player camera position ?
yes
yes ?
yes
why do you wanna change it
in the first place
what is the point of you doing it
for make a gun camera recoil / ads system

