#help-development
1 messages · Page 1461 of 1
Inventory inv = Bukkit.createInventory(player, 72, ChatColor.AQUA + "Your Profile");
yeah sizes over 6 rows aren't supported properly
And completely removed in newer versions :>
i remember when you used to be able to make 9 rowed chests by placing 3 chests in a row
you could only place the third chest if there was water in that block already
what is a minecraft plugin groupld and artifactld?
I wish Mojang would fix the rendering for bigger inventories
they are your group identifier
Would be cool to have
and your artifact identifier
the former identifies your group
the latter identifies your artifact, aka your plugin
to create a bedwars plugin what i need to set
i name them bedwars and bedwars or other?
You hve to do a lot lol
is your group called bedwars?
are you called bedwars?
is your plugin called bedwars?
or other like it and bedwars
i wanted to create the plugin name with <servername> bedwars
group id is the name of the people or group who made it
artifact id is the name of the thing that was made
anyone can help make strenght potions 2 30s potion:increase_damage:3600:0 {CustomPotionColor:9643043,Potion:"minecraft:empty",CustomPotionEffects:[{Duration:3600,ShowIcon:1b,Ambient:1b,ShowParticles:1b,Id:5b,Amplifier:0b}]}
group id i can set the servername?
player.addeffect smt
com.myserver
its for bedwars
What about it
what is the command to edit
um wot
You mean this ^^?
or the cmd to get effect?
its in the config btw
what
If you aren't developing a plugin, #help-server
um ?
but i dont know config stuff
this is not a "how to configure random plugin" channel
i set it.<servername> (the name of mine server that i don't want to give for now) in groupld
and bedwars in artifactld
good enough
Me.bedwars.lol
a good name xD
sD
it has to be a valid domain
xD*
my projects:
?
I never used a valid domain for projects
you should
yeah lol
Dont have one :/
if it is someone else's domain you could get taken down
github
if you don't have a domain, use your github url or me.yourname
in authors i need: <author1>, <author2>, ...
ok thx
You should strt making it now
Git has private repos
I barely make public projects
i have one public project that is mostly an antisemitic joke
Why dont you verify lol
because fuck your standards
lool why
because I use ripcord and I disabled that
o
tell me more
@tired spoke btw can u help with something
Spigot already has those
can i dm
how much are you paying an hour
so if i do
replace Key with a number
Value with item stacks
and then acces the Key 3 for example i would have the itemstack 3 linked to that number```?
so its like a link between things
an id
this is what you have already
but instead of a number it's a string with a number in it
didnt md_5 ban you the other day
dunno
he keeps kicking me but I haven't noticed a ban
lol
i might just be on a different alt today though, i don't really keep track
lmao
i can't see message links
you choose ignorance
send a screenshot
it's just md_5 and choco kicking you
mmm
anyone plugin support
so accessing a map is faster and better than checking if the itemstack clicked is the one in the config file
no, what you are doing right there is just as horrible as it was before
thats kinda cool
bro
lol
a configurationsection is just a string -> object map
you have changed it to a number -> object map
The plugin author
nothing has changed
and this?
i can't see replies
NNYaKNpGms0eUVpiSdHx — Today at 3:57 PM
use a map instead of iterating over a list
yeah, you should use a map instead of iterating over shit
right now you are using a map and still iterating over shit
so the goal is to acces directly the value
instead of the for if
using the map
with the key
itemstack equals, hashcode and issimilar are potentially catastrophically slow
you want to minimize the number of those calls as best as you can
Hello! I have this recipe, it's working but I want it to craft when there are 16 ender eyes. How do I do that?
Code:
ShapedRecipe srAote = new ShapedRecipe(NamespacedKey.minecraft("aote"), item );
srAote.shape(" E ", " E ", " D ");
srAote.setIngredient('E', Material.ENDER_EYE);
srAote.setIngredient('D', Material.DIAMOND);
Bukkit.addRecipe(srAote);
you have to do that manually using an event
not sure
if exact choice
supports the number
it doesn't
Yeah
crafting just doesn't work that way
I don't think ExactChoice supports stack size, so probably the event
mhm
okay, thx
yeah
When you buy 1000€ worth of BTC and now waiting to receive it 😑
is the dude behind the cat him?
is the dude in your avatar you
Maybe
what do you think is the dude in my avatar me
how can i set the ON/OFF plugin message on console with a custom color (gold or orange)
the dark side of the force is a path to many abilities most would consider unnatural
or however that goes
Lol
Actually both creatures in my profile picture are cats
do do do do break; while (false); while (false); while (false); while (false);
return φ |= φ &= φ |= !/**/false;```
what the fuk is this
it looks c o m p l e x
Its mostly bollox that does nothing
I get the following exception if i deploy the plugin on the server. Have anyone anyone idea?
Caused by: java.lang.ClassNotFoundException: org.json.JSONArray
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:102)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
it just returns whatever that boolean is lol
your runtime doesn't have org.json.JSONArray
how can i fix this?
On what version? Because I'm almost certain JSONSimple is shaded into the server
When do we get superposition booleans
I use Spigot Version 1.8.9
Oh, JSONSimple is shaded into the server. Though it's shaded under org.json.simple.JSONArray
you okay Choco? we are here for you
So I don't know where you managed to import org.json.JSONArray
I'm fine 😛
I checked my stats. Apparently I committed 1,800 commits I think just this year alone
thats at least 3 posts every day for 2 months with 2 days off
I enjoy what I do 
What is it you do
btw is there a way to set a Skull owner to like /give @p minecraft:player_head{SkullOwner:{Id:[IDS}} these things
I see
bro i started 5 months ago and did 171 wtf
Choco whats this https://github.com/2008Choco/Alchema/blob/main/src/main/java/wtf/choco/alchema/config/CauldronConfigurationContext.java
read the description lmao
lol thats like reading the manual of a rocket and hoping you know how to make one
what?
Every bit of my code is documented ;p
Its documentation will explain what anything in my code does better than I can explain it myself now
😄
Oddly accurate
ooo yeah I really wanted to buy it few days ago XD
myes
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equals("hello")) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.BLUE + "Hello, " + ChatColor.GREEN
+ player.getName() + ChatColor.AQUA +
". Your health has been restored!");
player.setHealth(20.0);
} else {
System.out.println("You are not allowed to use this through console!");
}
}
return false;
}``` Can I increase the health that I give the player past 20?
Health boost?
yes
😐
just give the player the effect
diddling with attributes might be more robust
you can add an attribute modifier directly to an entity i think
effects are kind of shit
in every way
https://www.youtube.com/watch?v=xIVfJzWRsTg LMAO tHIS IS SO TRUEE
zucc'd.
🔥 subscribe for more ;)
🔔 Turn Notifications on so you don't miss any future upload!
🔵 Follow me on Twitter: https://twitter.com/Milkair
Map Used: https://bit.ly/3fV4bvG
🎵 Music Used:
Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0
https://creativecommons.org/licenses/by/3.0/
Guys how use ChatColor.translateAlternateColorCodes('&', "message") - and back to symbols?
Guys how use ChatColor.translateAlternateColorCodes('&', "message") - and back to symbols?
No clue what is going on, but whenever I build artifacts (intelliJ) my .jar file only has the plugin.yml in it...
I have no idea what's going wrong.
I don't know what to provide you guys to resolve it
Example i have:
&ctest and i want to convert to color: ChatColor.translateAlternateColorCodes('&', "message") okey
How back to &ctest
can someone give me the colors id? for bw
for now i do
RED,
BLUE,
GREEN,
YELLOW,
AQUA,
WHITE,
PINK,
GRAY,
i need the missing 8
try like ChatColor. the Color you want
for me i need:
DARK_GREEN,
can i use orange?
for magenta i need purple or dark_purple?
quick question is the "isHatching" method from the "PlayerEggThrowEvent" returning a true or false value if the egg changed into a chick when it was thrown or some other way?
ok thx I got confused because I was looking at the spigot docs so I didn't know
yes like Color.ORANGE
dependes where you need to use the color
Scoreboard, chat and blocks
for scoreboard I think you can use both ChatColor and Color. ChatColor allows bold , underline
that is more limited in color options
for metadata you can use Color. ..
If you are in 1.16 you have full hex support for most text
ohhh that is nice, can you give an example?
ChatColor.of("#ffffff")
no, i use 1.12.2
?????
i am starting by 1.12.2
all the minecraft servers uses 1.8-1.12.2 of standard version
lol
when the facts are a lie
would this code print onto my console where I am running the plugin? ```java
@Override
public void onEnable() {
System.out.println("Plugin is enabled!");
Bukkit.getPluginManager().registerEvents(this, this);
}```
indeed
crazy stuff
tho I suggest using the Logger
I would advise using getLogger instead
Or just nothing because their is an enabled message by default
I would advise to do Bukkit.shutdown();
are you ppl talking to me?
so what can I use to print something onto console?
because system.out.println isn't working on the console for me
.
Someone know if team prefix work with spigot ? can't find a way to make them work
Depends on what you mean by work
like this line : java this.team.getTeam().setPrefix("test§6");
and nothing
and of course just after there is thisjava this.getTeamEnum().getTeam().setNameTagVisibility(NameTagVisibility.ALWAYS);
Are they in the team
yep i print it
And iirc the other player must be part of the same scoreboard
and tab change the player color name
haaaaa
maybe came from this
so i need to create a common team for every player ?
that show color name and prefix etc ?
the scoreboard assigned to a player defines what that player sees, not what is shown of that player to others
is there a way to get the current tick
you can make a custom event for it if you need more help dm me
nah I just want a function that can tell me the current tick
kekw
other than reflection or using paper, there is no reliable way of knowing the current tick
this is your answer to everything
you could create a task that runs every tick and increments a number by 1
but that is not reliable
i mean you could always run a program every tick and have it keep track
yeah that's the approach I'm taking
just call it every tick
whether or not it being unreliable matters to you depends on why you need the current tick
with bukkittasktimer
Curious what you need the current tick for
yeah, kind of an xy question here
basically
I'm designing a loop trigger for these skills I have on my bosses
and to do this I have one bukkit runnable loop
then I just check what the period of the loop that skill wants is
and I use mod on the current tick
for that a task that increments by 1 each tick is probably fine
yeah
yeah just do another bukkitrunnable running every tick
but, if you want to do it the proper way around, use paper or grab the current tick from the nms field via reflection
neither of those are really worth it
why
I'm developing for a spigot resource
as the 60% of your userbase is going to be pissed at you for f.e causing synchronous chunk loads
you can fix that using paper-lib or whatever that dependency is
without losing spigot support
myeah
if so required
i suppose the most important things are doable through paperlib
not quite everything though
stuff like async tab completition comes to mind
Maybe it should have that too
I’m still not willing to drop support for the other 40%
well i guess you don't really need paper or paperlib for it as it's event based
but you do have to jump through some hoops to have your plugin not explode on spigot
since it's event based, doing it in the lib would be quite difficult
shade it in and you get issues because of duplicate classes, don't shade it in and you explode on spigot because of missing classes
maybe some kind of a factory method for a listener that shits out a consumer for a wrapper event
not exactly clean but eh
- it's not really a drop in replacement, as you'd have to account for it being async, so you'd need to impl both a sync completer and an async one
pretty sure paper lib is drop in
I think the async completer or whatevs just completes synchronously if on spigot
it has that? how's that supposed to work
i'll have to take a look
doesn't seem to have it
since the async tab complete functionality is event driven, it would be pretty difficult to do with the lib
and since your code would be run asynchronously, it wouldn't be drop-in
you can't just take code that was written to be executed synchronously and then execute it asynchronously, and expect it to work
and doing it the other way around has plenty of risks as well
all of the other async related features in the lib queue work to be done by the server asynchronously
f.e getChunkAsync does the get asynchronously; your work with the chunk should still be sync
so what you do with it can just be dropped in after getting the future's result, it will execute with the same semantics whether it's paper or spigot
guys how do I make a map of 0 0?
What are Persistent Data Containers?
data containers
World world = Bukkit.getWorlds().get(0);
MapView map = Bukkit.createMap(world);
map.setCenterX(0);
map.setCenterZ(0);
map.setScale(Scale.CLOSEST);
that are persistent
(this doesn't work)
I need to "render" it somehow
but I don't understand how
bruh I can't believe no one knows how to do this simple thing
Literally a 10 second google
what is a dependency injwectoin
you pass your plugin instance to another class through the constructor
like the public instance() thing?
I don't understand it tho
Create a Renderer and then add it using the MapView#addRenderer method
dependency injection is when one object depends on another object
sure, but that's not really the intended object-oriented way to do it
and the object (dependent) that depends on the other object (dependency) is given the dependency
the dependency is given, rather than retrieved
it is "injected" into the other object
What render just renders the map normally? just get the blocks around the center and draw them?
It will render the map.
for example your Listener object might depend on your config object
It's the MapRenderer object
therefore you would pass the dependency to the dependent, you'd inject the config into the listener
usually through the constructor
the intention of dependency injection is that the dependent doesn't need to care where the dependency comes from, nor does it have to have any logic to retrieve the dependency from anywhere
the dependent is simply given a suitable dependency
your listener doesn't need to care what the config is or where it comes from
only that it performs its intended function
eyes
ruining such a neat explanation of DI with something as useless 😦
i'm a pretty neat guy
MyRenderer = MapRenderer(); // https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/map/MapRenderer.html#%3Cinit%3E()
map1.addRenderer(MyRenderer);
I don't understand
learn java
public class AmogusGremlin extends EntityZombie {
public AmogusGremlin(Location location) {
super(EntityTypes.ZOMBIE, ((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
Zombie craftZombie = (Zombie) this.getBukkitEntity();
this.setBaby(true);
ItemStack itemStack = new ItemStack(Material.WOODEN_HOE);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setCustomModelData(3);
itemMeta.setUnbreakable(true);
itemStack.setItemMeta(itemMeta);
craftZombie.getEquipment().setHelmet(itemStack);
craftZombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
craftZombie.setSilent(true);
craftZombie.setCustomName(ChatColor.translateAlternateColorCodes('&',"&4&lAmogus Gremlin"));
craftZombie.setCustomNameVisible(true);
this.getWorld().addEntity(this);
}
public void initPathfinder() {
super.initPathfinder();
this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, true));
}
@Override
public void entityBaseTick() {
super.entityBaseTick();
this.pitch = 0;
this.lastPitch = 0;
}
}
Hi! I've got a custom entity working, but I can't figure out how to make the entity not change it's pitch
same NNY
just setting the pitch won't update players about the changed pitch i'm guessing
can you help me understand what to do then or nah?
Please help
I just need to finish this code so it renders
and i doesn't seem like a trivial task
Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");
//Make namespaced keys
NamespacedKey OPkey = new NamespacedKey(KitDuels.instance, "OP");
NamespacedKey Bowkey = new NamespacedKey(KitDuels.instance, "BOW");
NamespacedKey Axekey = new NamespacedKey(KitDuels.instance, "AXE");
//Make OP kit
ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta opMeta = OP.getItemMeta();
opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
opMeta.getPersistentDataContainer().set(OPkey, PersistentDataType.DOUBLE, 4);
Honestly confused, there's an error on PersistentDataType.DOUBLE
and what's the error
never mind
it was because persistentdataype was double instead of int
but why do i need the value though
myes
the value is the value you set
the number?
the persistent data container contains data
the data is stored by key
the double is your data
the namespacedkey is your key
so if i only want to use the key, the value wont matter?
ideally you would only use one key and change the value based on the item
the key could be myplugin:itemid, and the value might be "AXE" or "BOW"
if (sender instanceof Player) {
Player plr = (Player) sender;
//Make the inventory
Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");
//Make namespaced keys
NamespacedKey OPkey = new NamespacedKey(KitDuels.instance, "OP");
NamespacedKey Bowkey = new NamespacedKey(KitDuels.instance, "BOW");
NamespacedKey Axekey = new NamespacedKey(KitDuels.instance, "AXE");
//Make OP kit
ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta opMeta = OP.getItemMeta();
opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
opMeta.getPersistentDataContainer().set(OPkey, PersistentDataType.INTEGER, 1);
OP.setItemMeta(opMeta);
//Make Bow kit
ItemStack bow = new ItemStack(Material.BOW);
ItemMeta bowMeta = bow.getItemMeta();
bowMeta.setDisplayName(ChatColor.AQUA + "Bow 1v1");
opMeta.getPersistentDataContainer().set(Bowkey, PersistentDataType.INTEGER,2);
bow.setItemMeta(bowMeta);
//Make Axe Kit
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemMeta axeMeta = bow.getItemMeta();
axeMeta.setDisplayName(ChatColor.AQUA + "Axe 1v1");
axeMeta.getPersistentDataContainer().set(Axekey,PersistentDataType.INTEGER,3);
axe.setItemMeta(axeMeta);
what about this?
that makes even less sense
wtf
and use PersistentDataType.STRING?
for example yes
also you're adding the second one to the opMeta
what about this
if (sender instanceof Player) {
Player plr = (Player) sender;
//Make the inventory
Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");
//Make namespaced keys
NamespacedKey key = new NamespacedKey(KitDuels.instance, "KitDuels");
//Make OP kit
ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta opMeta = OP.getItemMeta();
opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
opMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "OP");
OP.setItemMeta(opMeta);
//Make Bow kit
ItemStack bow = new ItemStack(Material.BOW);
ItemMeta bowMeta = bow.getItemMeta();
bowMeta.setDisplayName(ChatColor.AQUA + "Bow 1v1");
opMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING,"BOW");
bow.setItemMeta(bowMeta);
//Make Axe Kit
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemMeta axeMeta = bow.getItemMeta();
axeMeta.setDisplayName(ChatColor.AQUA + "Axe 1v1");
axeMeta.getPersistentDataContainer().set(key,PersistentDataType.STRING,"AXE");
axe.setItemMeta(axeMeta);
that's better, but name the key better
then i can do .get() to check if it's OP, BOW, AXE etce tc
any suggestions for the key?
kit-type or something
i'm trying to make a duel plugin where they do /duel <playername>, an inventory gui pops up with 3 kits to select from, then once they choose one, the duel is sent to the player
but here's the thing
how would i send the request to the specific player after inventory click
like how would the plugin know
or how would it pass it down
(please ignore the plenty amount of method call chains)
package me.notprankster.kitduels;
import me.notprankster.kitduels.data.KitDuelsMap;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
public class InventoryListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getView().getTitle().equals("Choose a kit")) {
if (event.getCurrentItem().getItemMeta() != null) {
//OP kit
if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
event.setCancelled(true);
p.closeInventory();
//bow kit
} else if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
event.setCancelled(true);
p.closeInventory();
} else if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
event.setCancelled(true);
p.closeInventory();
}
}
}
}
}
don't call getItemMeta repeatedly
each time you call it, the entire itemmeta is cloned
call it once and store it in a variable
//OP kit
if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
event.setCancelled(true);
p.closeInventory();
//bow kit
} else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
event.setCancelled(true);
p.closeInventory();
} else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
event.setCancelled(true);
p.closeInventory();
}
}
}
?
send them a message in chat that <Player> wants to duel them. The text can have a click event for them to accept
thats something close to pvplegacy, but the problem is how do i make it so that the plugin knows which kit
the raw slot number
probably one of the easiest ways
InventoryClickEvent
has a getRawSlot()
returns an int
how would i use that to compare
is the inventory a standard 54 slot inventory?
if (sender instanceof Player) {
Player plr = (Player) sender;
//Make the inventory
Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");
oh, just like in the index
yeah
but how do i use it to compare
like how do i pass that info down
when the player clicks on the text
Oh they both have to use the same kit?
ye
when duel is sent the target is sent a message saying
"<playername> wants to duel you on <kit name>, ACCEPT | DENY"
I'd create a Duel system whereby when a player requests a duel, their UUID along with kit is stored in a map,
Map<UUID,String> duelRequests = new HashMap<>();
When the player selects a kit in the inventory, that kit is added to the map, using his player UUID as the key. The second player can accept the duel by clicking ACCEPT, The click event of the ACCEPT text has player 1's UUID so his duel can be fetched from the map along with the kit to start the duel.
thats what i did for a certain class though which stores all requests
package me.notprankster.kitduels.data;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class KitDuelsMap {
public static Map<UUID, UUID> duelRequests = new HashMap<UUID, UUID>();
}
You don't technically need the other players UUID
oh
how do i make it so that the accept text would have player1's uuid though?
doesn't perssing it just make the player do a command?
yeah
you could just have a anonymous/unwritten command
or use the same duel command
so when they click ACCEPT, /duel is ran for that player
and a check will be performed on the map
for that UUID
/duel could accept a player name or a player UUID as argument 0
if a player name is used, create a new duel, if one doesn't already exist
if a player UUID is used, check for an existing duel
none of you guys know how to write a script that draws a map around 0 0? 🥺
I do not understand
you clearly have zero clue of what you are doing or how to use the language
MyRenderer = MapRenderer(); // https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/map/MapRenderer.html#%3Cinit%3E()
map1.addRenderer(MyRenderer);
I don't understand
...
dude me all you want but this is a shining red flag of "i have no idea of what i'm doing"
1 that is not how you declare a variable
i know
2 that is not how you call a constructor
3 that is not how you should name a variable
go read a java tutorial and come back after you are at least vaguely familiar with the language
that is the solution
learn java
clearly not
i was just typing two lines
two lines that are completely and thoroughly wrong in every way possible
here is a manhunt plugin I wrote like 7 months ago - https://github.com/Lainad27/McPlugins/tree/main/manhunt/src (it is not pretty)
now that I have proven that I understand java, can you help me?
write those two lines in a way that isn't ass backwards and I may consider it
ok 1 sec
It’s not good code
You put ur commands and listeners in the same class
And you registered the listener from the class that is the listener
mapView.addRenderer(new MapRenderer() {
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
//code goes here
});
Even though you registered it in main
i dont care about that plugin. The only one thing I care about rn is rendering a map around a coordinate
ah fairs
well anyway
there is no "code" to render a map normally like minecraft does so
what do i do?
I have no experience with this but I imagine this is gonna be nms, right?
Nah
Spigot has classes for this
Have a look at this thread
Idk, I haven’t used this api
Ahh, there is a method under Bukkit to make a mapView, makes sense
That’s quite interesting - can you customise the contents of the map or does it take it from the world?
you can implement your own renderers to do a bit of everything afaik
i haven't really diddled with maps though so idk how bothersome or robust the api is
Yeah - I haven’t either
I saw someone’s media player on here though and wondered if they probably used a custom renderer
Makes a webapp using maps
it's probably on the protocol layer
Actually fair
I mean - it was like at least 15 FPS video
It looked quite cool
Ohh I found it
It’s the PulseBeat guy
- conclure
idk, his code throws this
"this"
Implicit super constructor EntityHuman() is undefined. Must explicitly invoke another constructor
Constructor call must be the first statement in a constructor
going back to the basics of java
the super constructor call must be the first statement in a constructor
exactly as it says
you can't do anything before calling it
I mean, just remove the null check and don’t send it null 🤷♂️
As long as this isn’t an api that is
i don't think any mappings include param names
see the source and the mappings for what it's used I suppose
seems to have something to do with position and rotation
yaw :thonk:
how can I use "CREATE_FOG" In BarFlag enum? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/boss/BarFlag.html#CREATE_FOG
declaration: package: org.bukkit.boss, enum: BarFlag
@wraith apex How do I go about finding the player ?
if (event.getView().getTitle().equals("Choose a kit")) {
if (itemMeta != null) {
//OP kit
if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
event.setCancelled(true);
KitDuelsMap.duelRequests.put(p.getUniqueId(),"OP");
Set<NamespacedKey> target = itemMeta.getPersistentDataContainer().getKeys();
p.closeInventory();
//bow kit
} else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
event.setCancelled(true);
p.closeInventory();
} else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
Player p = (Player) event.getWhoClicked();
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
event.setCancelled(true);
p.closeInventory();
}
}
ok this is it im running the code
https://github.com/dniym/IllegalStack/wiki/GUIObject or store a map of uuid and inventory
cause what if someone renames a chest to "Choose a kit"?
all broken.
hey any one know how would I generate playerdata file uuid.dat
for player which never played before on server ?
I want to generate it from UUID
Asking about your attempted solution rather than your actual problem
thanks you, but I have question. should I use barFlag with creating bossbar?
Bukkit.createBossBar takes barflags, or you can add them later
ty, but should I apply bossbar to player?
it takes forever to download stuff from gamebannana
lmao
gamebannana's servers are bad
it keeps stopping the downLoad
i have to keep resuming it
and this is related to development in which way?
nothing i just want to say my issues with it
bruh the map images came up a bit croped 😦
Hello, How can I remove bossbar from screen? but I want to keep barflag
bar.addFlag(BarFlag.CREATE_FOG);
bar.addPlayer(event.getPlayer());
}```
its my bossbar
If i use bar.setVisible(false); barflag removes
also, hidebar() same
that's really odd, are ender crystals really not living entities?
how come armor stands are living entities but not ender crystals?
mojang
smh
this is going to break so much shit
I had my entire system tuned for living entities
they should be wtf
I mean ender crystals are still entities
considering the point is to hit them I'm just surprised they're not living entities
Anyone know how to limit map markers on a map? as seen (being abused) here https://www.youtube.com/watch?v=W12zKDvHsQI
Also for the MapInitializeEvent I could only find on docs that it gets called 'when initialised' is that when its loaded (in a item frame, or held) or when it gets created or both
Probably when it goes from a blank map to not a blank map
Trying to play around with mySQL but, having problems. Is someone able to assist, my current code is ```java
public void createPlayer(Player player) {
try {
UUID uuid = player.getUniqueId();
if (!exists(uuid)) {
PreparedStatement ps2 = plugin.SQL.getConnection().prepareStatement("INSERT IGNORE INFO chatlogs"
+ " (NAME,UUID) VALUES (?,?)");
ps2.setString(1, player.getName());
ps2.setString(2, uuid.toString());
ps2.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
data.createPlayer(player);
}
```However, it responds with...
😢 I thought that was INTO lmao
Is it worth replacing all file written stuff, and using MySQL instead
Depends
Would you have any idea to limiting the markers on them?
that looks like a .... well you knowe
ignore the mickey mouse
Nice cock bro
:troll:
but yeah look at the amount of markers
place a of few of those maps, every player is at 0 fps
with enough it sends enough data to the server to lag it
internal ddos, I'd like to patch it 😄
lol, I'm just trying to create a plugin that uses MySQL so that I can make a web dashboard for logging stuff
There's not really any up to date portals with good dependencies, so I'm just going to make one that works with a few plugins I use
public void onAbilityUse(Player player, SItem sItem)
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 5f, 5f);
for (Entity entity : player.getWorld().getNearbyEntities(player.getLocation().add(player.getLocation().getDirection().multiply(3.0)), 3.0, 3.0, 3.0))
{
if (!(entity instanceof LivingEntity)) continue;
if (entity instanceof Player || entity instanceof EnderDragon || entity instanceof EnderDragonPart) continue;
User user = User.getUser(player.getUniqueId());
entity.setVelocity(player.getLocation().toVector().subtract(entity.getLocation().toVector()).normalize().multiply(-1.0).multiply(50.0));
user.damageEntity((LivingEntity) entity, 12000.0);
}
}
can u help me a bit, i want this code to damage all entities expect villager
Only continue if it’s a villager then?
is there any fresh tutorials to edit spigot? I tried with this https://www.spigotmc.org/threads/tutorial-adding-custom-patches-to-spigot.158694/#post-1685752 but it's too old
Check the contributing instructions
You need a gpg key right to get your group id with projects onto central
to sign artifacts
How can I get a mapcanvas from a itemstack in 1.12
how would I go about letting zombies (and hostile mobs in general) spawn during the daytime?
Write your own spawning system
Or modify the game code
Or simulate daytime with player.setTime
I'm planning on taking the game code route
is there like a "canSpawn" method that I could override to return true regardless of light level?
Probably
theres probably a mobspawnevent of some type
Yes but how will that help
declaration: package: org.bukkit.event.entity, class: EntitySpawnEvent
right, that's called when a mob spawns
you can check if the mob is hostile
But it won’t be called
right, but that won't be called during the day
if it is then you can try overriding its spawn conditions
Since the mob never spawns
oh true
but it's never called because the server never spawns it
must be, i just need to find it
Like I said
write a spigot patch
Or re-implement all entities with a custom class that overrides the spawn check method
anyone know a secure way to give someone a token through console that they can connect with my discord bot?
Uhh like encryption?
yea
im just trying to figure out how to communicate with my bot and my minecraft plugin
i think i can but its kinda difficult
So I'm creating a survival games plugin but when I run a server with the plugin I get this error, can anyone help me?
[20:44:01] [Server thread/ERROR]: Could not load 'plugins\TerrorGamesTest4.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `io.github.nightterror04.Main'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:787) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.ClassNotFoundException: io.github.nightterror04.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:435) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:468) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
means that the class cant be found
whats your plugin.yml
and screenshot your whole package structure thing with the classes
okay
this is my plugin.yml
name: TerrorGames
main: io.github.nightterror04.Main
api-version: 1.16
version: 1.0
load: POSTWORLD
description: >
A Plugin By NightTerror
commands:
tg:
description: Main command.
vote:
description: Vote command.
votestart:
description: Vote command.
and heres all the classes
I'm kinda new to this so I really don't know what I'm doing lol
what the fuck
Your plugin.yml points to an entirely different class
Also java 7?
your classes
And decompilation artifacts
I think I got it now
but I jusy have one question should my api version be 1.16 or 1.16.5
because I've had people tell me both
okay thanks
you should set it to 1.12.2
why?
because 1.12 best vershun no lag!
he tells everyone that
interesting
but why would I want a 1.12.2 plugin on a 1.16.5 server?
yeah I think so
I changed the java version to JavaSE 1.8 is that the correct java version?
he said it himself ladies and gentlemen 1.8 is the best version
Java 1.8
context is not applicable
yeah so I changed my main I figured out I had that wrong and now its pointing to the same place all my classes are in and so I'm gonna try to run the server again and hope it works
For some reason Java has several names for their versions
Java 8, 1.8, class version 55
Although no one really uses class version in conversation
also everytime I export I get this warning does it mean anything?
JAR export finished with warnings. See details for additional information.
TerrorGames/META-INF/MANIFEST.MF was replaced by the generated MANIFEST.MF and is no longer in the JAR.
Problem writing TerrorGames/module-info.class to JAR: duplicate entry: module-info.class
duplicate entry: module-info.class
do you have your output of the new .jar in your plugin folder for the server
I think that is just telling you you are just overriding the new plugin.jar
?
no its in the spigot api folder
But now I'm getting an entirely different error
Fatal error trying to convert TerrorGames v1.0:me/TerrorGames/SurvivalGames/Main.class
should I just send the entire lastest.log for the server? Feel Free to ping me if you read it
Well its here now if someone wants to read it
Simple question but if I want to add a text file for settings for my plugin, under which file would I create the text file?
aka the resources directory
In this case, yes
Unrelated but, do you guys know any text generators that can do this?
______
(____ \\
____) ) ___ ___ ___
| __ ( / _ \\ /___)/___)
| |__) ) |_| |___ |___ |
|______/ \\___/(___/(___/
oh yes, thank you so much!
is entity.hasLineOfSight(other) an method that can be called async without worries?
thx
What is the best way to check if the given item is a hoe?
Item in hand?
if (player.getInventory().contains(item,1){} ig
btw does getClickedBlock() exist in 1.8?
i don't mean that
I'll need to check for EVERY SINGLE Item if i do so, DIAMOND_HOE, IRON_HOE etc..
I just want to check if the item is hoe
EZAfkCommand afkCommand = new EZAfkCommand();
Team afkTeam = afkCommand.getTeam();
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {
}
since I can't access afkCommand.getTeam() without making it static and can't return the team in the afkCommand class without making it static and can't get the team without making it static
is it fine if i do this?
Maybe using their name.
if(item.getType().name().endsWith("HOE")){
// code if item is hoe
}
can anyone answer my question
_ _
I just want to make sure that this method is not a bad idea
I am doing the same for 2 more listener classes
what you are trying to do?
basically making an afk plugin
and every afk player will be stored in that class?
package me.notprankster.ezafkplugin.events;
import me.notprankster.ezafkplugin.commands.EZAfkCommand;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.scoreboard.Team;
public class PlayerDamageListener implements Listener {
EZAfkCommand afkCommand = new EZAfkCommand();
Team afkTeam = afkCommand.getTeam();
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
EntityDamageByEntityEvent entityEvent = null;
if (event.getCause().equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) {
entityEvent = (EntityDamageByEntityEvent) event;
}
if (event.getEntity() instanceof Player) {
if (afkTeam.hasEntry(event.getEntity().getName())) {
event.setCancelled(true);
if (entityEvent != null) {
Entity damager = entityEvent.getDamager();
assert damager instanceof Player;
Player damager2 = (Player) damager;
damager2.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "That player is AFK!");
}
}
}
}
}
this is the code now for the code i sent earlier
it will be checked if the player is in the afk team
package me.notprankster.ezafkplugin.commands;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.scoreboard.Team;
public class EZAfkCommand implements CommandExecutor {
ScoreboardManager sbManager = Bukkit.getScoreboardManager();
Scoreboard sb = sbManager.getNewScoreboard();
Team afkTeam = sb.getTeam("AFK");
public Team getTeam() {
return this.afkTeam;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (afkTeam == null) {
afkTeam = sb.registerNewTeam("AFK");
afkTeam.setSuffix(ChatColor.translateAlternateColorCodes('&'," &c&b*AFK*"));
}
if (afkTeam.hasEntry(p.getName())) {
afkTeam.removeEntry(p.getName());
p.sendMessage(ChatColor.GRAY + "You are no longer AFK.");
} else {
afkTeam.addEntry(p.getName());
p.sendMessage(ChatColor.GRAY + "You are now AFK.");
}
} else {
sender.sendMessage(ChatColor.RED + "The console can't be AFK, silly!");
return false;
}
return true;
}
}
this is the code for EZAfkCommand
okay, don't do that.
what should i do?
create like a manager class
okay so create a class
and then do the same thing that you do on the EZAfkCommand class.
the scoreboard team
i do new managerclass() on the main class
and then i make a getter method?
then that's how i will obtain the team?
create a getter for the team on the manager class
so
mainClass.getAFKManager().getTeam()
yes.
Do you have the sign as a reference?
ye
thanks you but Bukkit.broadcastMessage(((FaceAttachable) event.getBlock()).getAttachedFace() + ""); doesn't work
ah
uh getFace returns blockface
I want to get block with the sign
use Directional#getFacing().getOppositeFace()
ah
yes, you do getRelative on the sign
Block signBlock = event.getBlock();
Block chestBlock = signBlock.getRelative( ((Directional) signBlock.getBlockData()).getFacing().getOppositeFace());```
hm
SignBlock class doesn't exists
getRelative method doesn't exists in Sign class
of course not, thats your sign
teh Block that is the sign
((Sign) event.getBlock()).getR
.getRelative doesn't exists in location xD
getRelative IS on Block
okay sorry
thanks you!
how to get BlockFace? ((Block) event.getBlock)).getBlockFace, event.getBlock().getBlockFace() doesn't exists
Caused by: java.lang.NullPointerException
at me.notprankster.ezafkplugin.EZAfkManager.<init>(EZAfkManager.java:10) ~[?:?]
at me.notprankster.ezafkplugin.EZAfkPlugin.<clinit>(EZAfkPlugin.java:11) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_291]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_291]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[patched_1.16.5.jar:git-Paper-645]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[patched_1.16.5.jar:git-Paper-645]
... 7 more
this is line 9-11 of ezafkmanger
public class EZAfkManager {
ScoreboardManager sbManager = EZAfkPlugin.instance.getServer().getScoreboardManager();
Scoreboard sb = sbManager.getMainScoreboard();
and line 10-15 of ezafk plugin
public final class EZAfkPlugin extends JavaPlugin {
public static EZAfkManager AFKManager = new EZAfkManager();
public static Team getTeam(){
return AFKManager.getTeam();
}
why is that error happening?
ty!
Your instance field is not set when you try to create your EZAfkManager.
what is instance field
EZAfkPlugin.instance
the error happened
way before i did that
this is instance
public static Plugin instance;
@Override
public void onEnable() {
// Plugin startup logic
instance = (Plugin) this;
getCommand("afk").setExecutor(new EZAfkCommand());
getServer().getPluginManager().registerEvents(new PlayerDamageListener(), this);
getServer().getPluginManager().registerEvents(new PlayerMoveListener(), this);
}
and the erorr happened before i added instance variable
so that's not the problem
You are creating static fields which are created before onEnable ever runs
instance is null
how? iset its value to (Plugin) this inside of onEnable()
are you not reading what I write?
ElgarL: You are creating static fields which are created before onEnable ever runs
yes but you specifically said instance is null
when i've done it before and there was no problem
yes, you set instance IN your onEnable
that code has not yet been executed so your instance field is still null when you try to create your manager class.
ohhh
so does declaring the static fields below onEnable() and onDisable() make a difference
no
or should i declare it inside onEnable()
actually
declare outside
but set value insinde onEnable()
you can declare teh field, then initialize it in onEnable
yes
?
[13:57:22 ERROR]: Error occurred while enabling EzAFK v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at me.notprankster.ezafkplugin.EZAfkPlugin.getTeam(EZAfkPlugin.java:14) ~[?:?]
at me.notprankster.ezafkplugin.commands.EZAfkCommand.<init>(EZAfkCommand.java:17) ~[?:?]
at me.notprankster.ezafkplugin.EZAfkPlugin.onEnable(EZAfkPlugin.java:22) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-645]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-645]
Any idea why this doesnt reload the config
if (args[0].equalsIgnoreCase("reload")) {
if (!(plr.hasPermission("safecheck.reload")) || !(plr.hasPermission("safecheck.admin")))
return true;
plugin.reloadConfig();
plr.sendMessage(
ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("reloadmessage")));
return true;
it sends the reload message
But anything i change in the config it doesnt change in-game
EZAfkPlugin line 14
what is it
Hey can somone help me troubleshoot GSON?
java.lang.NullPointerException: Cannot invoke "com.putopug.cmdui.config.Slots.getSlots()" because "com.putopug.cmdui.config.DeJsonizer.slts" is null
at com.putopug.cmdui.Inventory.init(Inventory.java:17) ~[?:?]
at com.putopug.cmdui.config.DeJsonizer.init(DeJsonizer.java:23) ~[?:?]
at com.putopug.cmdui.CmdUI.onEnable(CmdUI.java:14) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:364) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:592) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1066) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-683]
at java.lang.Thread.run(Thread.java:831) [?:?]
is the NPE i get
and ive trieed literally everything
https://github.com/PugsMods/cmdui
is all the code i have
nvm that, i fixed it
but then i ran into another problem
[14:11:38 ERROR]: Could not pass event PlayerMoveEvent to EzAFK v1.0-SNAPSHOT
java.lang.NullPointerException: null
at me.notprankster.ezafkplugin.events.PlayerMoveListener.onPlayerMove(PlayerMoveListener.java:21) ~[?:?]
if (afkTeam.hasEntry(p.getName())) {
this is line 21
this is afkTeam Team afkTeam = EZAfkPlugin.afkTeam;
main class
public final class EZAfkPlugin extends JavaPlugin {
public static EZAfkManager AFKManager;
public static Team afkTeam;
public static Plugin instance;
@Override
public void onEnable() {
// Plugin startup logic
instance = (Plugin) this;
getCommand("afk").setExecutor(new EZAfkCommand());
getServer().getPluginManager().registerEvents(new PlayerDamageListener(), this);
getServer().getPluginManager().registerEvents(new PlayerMoveListener(), this);
AFKManager = new EZAfkManager();
afkTeam = AFKManager.getTeam();
}
and afkmanager
public class EZAfkManager {
ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
Scoreboard sb = sbManager.getMainScoreboard();
Team afkTeam = sb.getTeam("AFK");
public Team getTeam() {
if (afkTeam == null) {
afkTeam = sb.registerNewTeam("AFK");
afkTeam.setSuffix(ChatColor.RED + "" + ChatColor.BOLD + "*AFK*");
}
return afkTeam;
}
Hi I wanted to create a placeholder that removes commas from a number in a placeholder, short words, there is a placeholder and I want to remove the commas, you can do it in JavaScript, Thanks !!
this server is not a spoonfeeding service
do WeakHashMaps work with Spigot?
crosspost from papermc server
ok
like will a UUID, Long map be auto GCs'd?
a
How to check if player clicked an itemin the inventory
the map itself? just if you dont refer to it again
InventoryClickEvent
InveotryClickevent
no like entries inside of it
what xale said
and even then its rare that its being gc't
just if they are out of the map
and nothing refers to it
not in InventoyClickEvent
someone help me pls
its #getItem
is the player maybe offline?
nope, they are online
its me actually
i connected through localhost
does this have anything to do with the player being offline?
if he would be offline the name would be null
otherwise what is AFKManager.getTeam?
basically, i am making an afk plugin
this is afk manager
package me.notprankster.ezafkplugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.scoreboard.Team;
public class EZAfkManager {
ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
Scoreboard sb = sbManager.getMainScoreboard();
Team afkTeam = sb.getTeam("AFK");
public Team getTeam() {
if (afkTeam == null) {
afkTeam = sb.registerNewTeam("AFK");
afkTeam.setSuffix(ChatColor.RED + "" + ChatColor.BOLD + "*AFK*");
}
return afkTeam;
}
}
i was told earlier that i should do this, since my last method was just doing new class() every time i wnated to obtain the team
does a team named "AFK" exist?
Yes
i checked if afkTeam is null as well in the AFKManager class, and if it was, create it and then set afkTeam's value to it
and then return that
i've also done /team list
and it does exist
14:11:44 INFO]: llaFoTdiaL lost connection: Disconnected
[14:11:45 INFO]: llaFoTdiaL left the game
team list
[14:11:57 INFO]: There are 1 teams: [AFK]
how does your MoveListener look?
package me.notprankster.ezafkplugin.events;
import me.notprankster.ezafkplugin.EZAfkPlugin;
import me.notprankster.ezafkplugin.commands.EZAfkCommand;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.scoreboard.Team;
public class PlayerMoveListener implements Listener {
EZAfkCommand afkCommand = new EZAfkCommand();
Team afkTeam = EZAfkPlugin.afkTeam;
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player p = event.getPlayer();
if (afkTeam.hasEntry(p.getName())) {
afkTeam.removeEntry(p.getName());
p.sendMessage(ChatColor.GRAY + "You are no longer AFK.");
}
}
}
the error is at if (afkTeam.hasEntry(p.getName())))
try to use your nullsafe method
nullsafe method?
getTeam
instead of the var itself
i couldn't declare functions/methods and initiliase them somewhere
cause if i did declare and initiliase them way before plugin enables an error is caused
create a method to initialize the team on the manager class
@covert bluff
public class AFKManager{
private Team team;
// Call this method on startup
public void initializeTeam(){
ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
Scoreboard sb = sbManager.getMainScoreboard();
team = sb.getTeam("AFK");
}
}
i told you to use getter, not static
how exactly
without making the method static
okay, first of all create a method to initialize the team on the manager class
and then create a getter for AFKManager in the main class.
do you know dependency injection?
i've heard of it, but i haven't learnt of it much
it's what was suggested to me back when i was trying to make a duels plugin
i don't really know much of it
it's basically passing an object thru class constructor.
