#help-archived
1 messages · Page 211 of 1
alternatively, with the inner class
public class TopDog {
public final BottomDog BOTTOM = new BottomDog();
public class BottomDog {}
}
to get the top from the bottom you would need either fuckery or write a getter, though
probably doesn't matter
i prefer smaller class files so I'd do the former
Why is it that putting 1.0 as a version in pom.xml pop up with main class not found errors???
It works fine if it's like 1.01 or like 1.0-SNAPSHOT so???
example please?
This sounds weird...
this sounds like user error
<version>1.0</version> This pops up with Main class not found errors
<version>1.01</version> or something like <version>1.0-SNAPSHOT</version> works fine?
that isn't the example I was looking for
it would best help to know where in the pom you are messing with
It's the default with the groupId, artifactId, then version
can you not just show the pom?
which IDE are you using intelliJ?
Yeah, it dosen't make sense because it's basically just default
Shouldnt you at least specify the spigot repo?
Well it does if intelliJ makes use of profiles to differentiate releases from snapshots
Yes but you will need to run BuildTools every time you want an update
that is the only thing I can figure @subtle wedge
a way to test would be to change the profile of the project
and see if you encounter the same problem
IE, try building a release version instead
Alright thanks
How can i set the item an npc has in their main hand using nms?
don't get from the map every time you need to access something in the player data
get the player data, hold it in a var, and access the values from that var
doing what you are doing now just fires 10000 million useless and redundant hashmap gets for no reason
whats a var?
short for variable
public void doShit() {
Object var = map.get(someKey);
var.doSomething()
}
oh so get the player data in the hashmap in a variable
yes
not doing that would be like you going shopping
but driving to the grocery store and back
for every single item
containskey does the same lookup as get
instead of an if clause with contains and then get
do get
test if null
and then do your stuff if it isn't null
Object value = map.get(key);
if (value != null) {
//do stuff with value
}
value is whatever your map contains
if it's a Player -> Data map, then value will be Data
my server console keeps getting spammed with preparing spawn area: 100% for the past 10+mins
yes its Player, Data
and data is the data in my data class
Required type: boolean Provided: Data
@pastel nacelle
im testing out my mobcoins plugin and when i right click a coin and its the last portion of coins in my inv the server crashes and gives this error
https://pastebin.com/RN44TfUs
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.
Hello everyone, I am back again. It has been a while and I still have made no progress. I no longer get any feedback at all, I just get nothing and I don't understand why. I have a main class, commands file, events file, and plugin.yml. I have no idea what to do, please help me get out of the hole.
Main Class: https://hastebin.com/epigeqiyax.java
Commands File: https://hastebin.com/oyevinupos.js
Events File: https://hastebin.com/ilokexodeh.java
plugin.yml: https://hastebin.com/ehofiqusoz.xml
so whats ur question? @golden geyser
Should I use a vps for a prison server?
@frigid ember I can't use any of my commands, as they return nothing. Could someone help me fix it.
Change:
if (label == "hub") {
to:
if (label.equalsIgnoreCase("hub")) {
/Hi would be the only one to use
is there any way to get pass this preparing spawn area span? its been going on for nearly an hr now
?
@paper compass i will switch gladly... im still lost on why this plugin doesnt work
Try it once you've switched
im testing out my mobcoins plugin and when i right click a coin and its the last portion of coins in my inv the server crashes and gives this error
https://pastebin.com/RN44TfUs
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.
Send the code
@EventHandler
public void onClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action action = e.getAction();
if(e.getItem() == null)
return;
if(action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
if(e.getItem().getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', "&e&l» &6&lMob Coin &e&l«"))) {
ItemStack item = e.getItem();
p.getInventory().removeItem(item);
utils.getMobCoinMap().put(p.getUniqueId().toString(), utils.getMobCoinMap().get(p.getUniqueId().toString())+item.getAmount());
p.sendMessage(ChatColor.translateAlternateColorCodes('&',
"&b&lPrimalMC » &7Redeemed &b" + item.getAmount() + " Mob Coins"));
return;
}
}
}
Okay
You need to do this:
public void onClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action action = e.getAction();
if(e.getItem() == null)
return;
if(action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
if(e.getItem().getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', "&e&l» &6&lMob Coin &e&l«"))) {
e.setCancelled(true);
ItemStack item = e.getItem();
p.getInventory().removeItem(item);
utils.getMobCoinMap().put(p.getUniqueId().toString(), utils.getMobCoinMap().get(p.getUniqueId().toString())+item.getAmount());
p.sendMessage(ChatColor.translateAlternateColorCodes('&',
"&b&lPrimalMC » &7Redeemed &b" + item.getAmount() + " Mob Coins"));
return;
}
}
}```
Try that
Np
did you just add the cancel event
in 1.12.2 if im looking to check the blocktype of Light Gray Concrete Powder, How would I go about making sure it only checks for the Light Gray variant?
if (block.getType() == Material.CONCRETE_POWDER) {
//code going here ```
try block.getData() then check if its == 7
Not sure if that still exists in 1.12.2 api
Looks like it is, thanks 🙂
np
Recipe recipe = event.getRecipe();
event.getWhoClicked().sendMessage(recipe.toString());
event.getWhoClicked().sendMessage(bottleRecipe().toString());
Why aren't these two the same...? I'm using the bottleRecipe() recipe I made and they both print differently
I either need help with that or I need help with adding a custom recipe that has different inputs and different outputs... Basically, let's say I want to put a potion into a recipe along with another item. How can I make the output be based on the potion, yet still be... the same? I'm working with CraftItemEvent in hope to use setResult(), although I'm not sure that's what I want
Yeah it’s probably best to do that
alright that's what im workin with
i just cant check for the recipe since they're considered different
Check the ingredients and then modify the output based on that
Last thing... what if I wanted to set the block to be the Light Gray concrete powder if it isnt?
Hello. Could you help me with a question I have about the bedwars plugin?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
block.setType()
block.setData
Well, I was wondering if the bedwars plugin brings with it achievable achievements, for example killing one and giving you an assassin achievement, can I explain?
So to make sure:
block.setData((byte) 8);```
can anyone help, ive been having this problem for a while, I cant seem to figure out how to give an entityplayer npc using nms an item in their main hand
I deleted my account a few months ago but the google result still pops up
does it ever get auto removed or do I have to make one of those requests
@upbeat scaffold I mean it will be there forever, someone could just go to archive.org and find it
🤷♂️
Does Player#spigot() not work in 1.16?
It does
🤔
for BaseComponent?
Yeah
no, i still use spigot() for that
Docs still says it’s there
well, I do have my API at 1.13
Yeah I know that's why I have no idea what's happening lol
I don’t think spigot is a method
I just converted my project to gradle, but everything else in the spigot API works
Isn’t it just a public variable
It is @lone fog
Here's the dependencies.
https://hastebin.com/kemisipozu.cs
At line 10, I get a NullPointerException, as the getString results in null. Although, At line 36, that is when I set the string, meaning getString should call that. Confusion is me
just the String ones are availalable from CommandSender
also i'm aware there will be an unholy amount of recipes added, i think that's just kinda how it'll have to work unless i found a work-around
what doc says it's there?
1.16.1 docs
oh you can't even get the spigot() to work in 1.16.1?
you are using a new itemStack. ItemStacks don't magically just have customized nbt data. @tiny pebble
It's something with gradle. If I run BuildTools and add that generated Spigot JAR to the project spigot() works
perhaps
compileOnly('org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT')
Nope, still not there
@keen compass
At line 47 I have the bottleRecipe() method with filledEnchantedSyringe being the parameter, which is itemStack. So since itemStack is used in the other method does it's NBT data not transfer over and rather just create another ItemStack? what do O.o
ah hm i could set a temporary itemstack and just make it equal to filledEnchantSyringe
ima test something
dang discord is messing my text up
I think it depends on the data?
Tried something like
ItemStack item = filledEnchantedSyringe;
Bukkit.addRecipe(bottleRecipe(item));
But it worked the same
gah
I think you misunderstand how recipes work
while although you can set your own recipe to be crafted, not everything you specify will be saved in the recipe information
also it depends on the crafting you want to do as well
yes you can simulate a recipe
what event would be the best for that? since CraftItemEvent happens after the item is crafted so
Depends on which crafting inventory you are using. But you would have to check using click events and what not
Is InventoryType.Crafting the same for crafting table as well as the player crafting inventory?
I've tried using InventoryClickEvent and InventoryDragEvent and it hasn't worked the best way although I'm most likely doing something wonky
no, that is for the crafting table. The crafting in the player inventory is called something else if I remember correctly
What you could do, is just keep track of your custom items
and apply the customized stuff after the crafting
since recipes are just for crafting items upon certain materials being used
Wouldn't that be with setResult(), most likely from CraftItemEvent?
Since that will set the result the second I craft it
swap it out from uncraftable potion to my intended potion
i think
man im going braindead
why would you need to swap it out?
o.O
just keep track of the custom stuff you want items to have, just apply that custom stuff to the itemstack after it is crafted if it matches your criteria or whatever
Since I don't want it to be uncraftable potion. Would it not need swapping and would it just... be?
you don't need to swap anything, just apply your custom stuff to the itemstack update it in the inventory as necessary. Don't need a previous item to hold anything
also don't need a real item to have a itemStack reference either
hmmm i see
alright i'll attempt it with InventoryClickEvent and/or InventoryDragEvent, if that doesn't work I'll resort back to CraftItemEvent
but we shall see
Sooo.... anyone figure out why spigot() doesn't exist when using Gradle?
I looked in the Player.class and it's just straight up non-existent lol
depends how you are building
are you using gradle to build spigot as what buildtools would do?
if so then it is because you are missing patches being applied
Okay so how do I get those 🤔
they are in the repo along with the sources
there is 2 patch processes that are done
well not so much patching but transformations are done first, and that happens when decompiling the minecraft jar
then after that is done, patches are applied to CB
then a clone copy of the repos is done of CB to create spigot repos
all you have to do is just look at the buildtools source to see the exact process
I don't think we're on the same page
never answered what you are doing 😛
I'm just adding the spigot-api dependency to my project
not actually building the spigot jar myself
ah, did you use buildtools for the API?
can always fetch the api from the spigot repo instead
I'm using the spigot repo.
But for some reason Player#spigot() doesn't exist when doing it that way
When I got the JAR from BuildTools it was there.
Did you inspect the API jar to ensure it is indeed the same from what is expected?
which repo are you using?
https://hub.spigotmc.org/nexus/content/repositories/snapshots
... and then the dependencies
@frigid vortex Addons...? You play on bedrock or something? lol
How can I add a resource pack and behavior pack
@upper hearth downloaded the latest api from the link you provided, the Player.Spigot() class is there
@keen compass Do my dependencies look correct then? No idea what I'm doing wrong
well you don't need both dependencies
CB doesn't exist in the spigot repos
try removing the CB dependency and keep the spigot-api one
Well I need the CB dependency for NMS
How do I add behavior packs?
then specify the spigot server jar instead
however the spigot server jar doesn't exist in the repos either
@frigid vortex Addons and Behavior packs are bedrock only
CB for nms 🤔
just remove CB and remove -api from the spigot dependency
Should have nms
nice
What is the last moment that a player can sent an unregisterchannel to the PlayerUnregisterChannelEvent ?
Would anyone know of a good lag prevention plugin
Something of that sort
Okay so say I have a list of ItemStacks. If I want to find which out of those ItemStacks has a specific material, how would I do that? But I can't do new ItemStack(), as that would be a completely different ItemStack to the one I am searching for
I have
public int getItemStack(List<ItemStack> list, ItemStack itemStack) {
int len = list.size();
return IntStream.range(0, len)
.filter(i -> itemStack == list.get(i))
.findFirst()
.orElse(-1);
}
Which will go through and search the list for the specific ItemStack I am looking for, but the specific ItemStack I just want to be any ItemStack with a specific material, in this case Material.MUSIC_DISC_CAT
could just do a contains() @tiny pebble
well yeah I have a contains(), but if it contains said item how would I access that specific item
if(list.contains(itemStack)) {
}
hm
that's why i tried the getItemStack method up there
for(Itemstack itemStack2 : list) {
if (itemStack2.equals(itemStack){
}
}
although it isn't meant to be a specific itemstack, as it has many different properties
which is why i wanted to see if i could grab it by the material
List<ItemStack> items = Arrays.asList(craftingInventory.getMatrix());
List<Material> materials = new ArrayList<>();
ItemStack test = null;
for (ItemStack item : items) {
if (item == null) continue;
materials.add(item.getType());
if (item.getType().equals(material)) {
test = item;
}
}
Would this do what I want?
the materials list is so I can look through the matrix via materials rather than specific itemstacks as the one (as mentioned before) has very unique properties
which change
I am sure quite a few here are @opal ingot
every time i restart my server it keeps preparing spawn area and it takes hours, what can i do?
I had a working javascript bot trying to use the XenforoAPI, but now it's not working anymore, when I retreive the data it fails to convert to JSON. Can anyone help me?
https.get(`https://api.spigotmc.org/simple/0.1/index.php?action=getAuthor&id=${id}`, async res => {
res.once("data", d => {
try {
JSON.parse(d);
} catch {
return;
}
});
});
Every time it calls the return method
anyone of u know
a voting plugin
that gives u rank up after hitting a certain vote?
Could do it with any voting plugin that has milestones
How long does it take staff to finally remove your resource?
Because the idiotic site doesn't let you remove your own resource yourself
Inventory inventory = Bukkit.createInventory(null, InventoryType.PLAYER);
inventory.setContents(event.getEntity().getInventory().getContents());
inventories.put(player, inventory);
//respawns.put(player, respawnTime.get(player.getGame()));
event.getEntity().getInventory().clear();
Is this how i save an inventor
y
Anyone know why im getting: "The method runTaskLater(Plugin, long) in the type BukkitRunnable is not applicable for the arguments (Indy, int)" from this:
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("spiel")) {
final World dl = Bukkit.getWorld("world");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "playsound indie_movie_01 master @a[x=319,y=63,z=38,r=15] 319 63 38 1.5");
dl.getBlockAt(328, 59, 31).setType(Material.AIR);
dl.getBlockAt(314, 25, 29).setType(Material.REDSTONE_BLOCK);
new BukkitRunnable() {
@Override
public void run() {
//add summon of armorstand
}
}.runTaskLater(this, 64);
}
return false;
}
}```
Then it should work
Well, I came across one issue while storing inventories
When I linked this to an entity, and the entity got teleported to a different world, the UUID would be the same, but the reference is actually lost
So what I do, by default
Which could be a help for you , is storing the inventory in a map <UUID, Inventory>
And so you would retrieve the inventory using the UUID instead
yeah
Ok, I am new to the plugins and spigot itself, so this may sound weird, but bear with me.
Can I add any of the pluggins without spiggot?
no
If I install spiggot, how do I get it on my server?
He said bear with me , so I believe there is an argument coming
^^^
put them in the plugins folder
Where do I find plugins folder?
ok
Don't forget to accept the EULA 🙂
how do I get it into the server in the first place
What is EULA?
sorry
once again new
First you need to install the server using BuildTools
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Instructions are there
so I have to make a new server then?
Ok,
once last question before some more reaserch
I am trying to setup some plugins,
Witch is better?
Bukkit
spiggot
BungeeCord
Others?
They all have their own purpose
ok
Except for bukkit and spiggot
Spigot is a fork of bukkit
But spigot is more optimized
Bungeecord is used for linking multiple servers together
And others , well you guessed it
when i click on a item in an inv that takes me to another inv 2 different inv click events get called 1 for each inv even tho i didnt click in the 2nd inv
@steady osprey , which event are you using?
InventoryClickEvent
for moderation related plugins, im guessing spigot?
just does the most
most generalized?
@west gull , spigot is the most famous. There are others, but no need for them.
@steady osprey , How are you bringing the user from one to the other inventory? Are you closing the first?
Can I also ask a question about the server here?
I would need to see your code @steady osprey
discord server*
@west gull , yes
I'm not sure. Most likely sending too many messages in a shorter period of time?
@steady osprey checking
Main inv listener:
https://pastebin.com/QFtMdp8P
the 2nd inv listener:
https://pastebin.com/H9QMdy1x
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.
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.
Okay, jus a moment please
Well, it looks like you got many different listeners for the inventory click
Did you already do some debugging so you know which listener is triggering?
yeah
You are trying to open an inventory, from another inventory
I think your problem is that you got many many different classes listening for the InventoryClickEvent
Certainly, one of these is getting triggered simultaneously with another one.
i dont think it is cause i check if its the correct inv title and if it isnt it returns
yes
I see, I would go a different approach
These inventories, they are always the same? People cannot put things inside this inventory right?
yea
yes
What I would do instead, I would create a map and a nice enumerable. Like this:
HashMap<InventoryGUI, Inventory> iventoryGUIPages = new HashMap<>();
And then, I would just retrieve the inventories required from the map based on the type
And in your onEnable() you can populate this map like this:
@Override
void onEnable(){
this.inventoryGUIPages.put(InventoryGUI.MAIN_PAGE, Bukkkit.createInventory(...))
}
And so whenever you need to open up an inventory page, you just retrieve it by using the InventoryGUI enumerable
Inventory mainMenu = inventoryGUIPages.get(InventoryGUI.MAIN_PAGE);
It's never good to use the title as the identifier
@steady osprey , that should solve your issue.
oh boy
The actual organization on where you store the HashMap itself , etc ... that you need to decide yourself ofcourse. I always work with services calling repositories
StringBuilder() builder = new StrinBuilder();
builder.append("something");
is the stream code for collect really bad performance wise or decent enough?
If you ask me, it really depends on how much data you are speaking of. stream is for iterating over a collection and is very powerful for filtering in collections
I use it quite often, no performance issues whatsoever
If anyone else has a different opinion on that, feel free to share 😄
Anyone know how to turn a FileWriter -> async writing and BufferedReader -> async reading?
Im writing a custom yaml parser kek
Im assuming to have a playerbase of like 100 concurrent players
so Idk if I can use stream
especially because most stuff is custom
it might be great for creating your own game and stuff but minecraft does not handle it well lol
@buoyant path , what are you trying?
its a large concept
basically a prison system with custom cells, gangs, levelling system (you can wear armor when you reach a certain level), you have custom mining with packets, custom loot systems
Its a lot
also like tons of animations with armorstands
Sounds interesting, but you could always store your objects with a unique identifier in a hashmap so that you don't need to use a stream
I guess so
That should do the trick
Hello! I been trying to fix this issue but i can't! Please help!
Could not load 'plugins\Hello World.jar' in folder 'plugins': uses the space-character (0x20) in its name
it literally fucking tells you the problem
in the one line error
"uses the space-character (0x20) in its name"
plugins cant have spaces in their names
@frigid ember , you need to remove the whitespace in the name of your plugin.yml
a free web based host that isnt on linux
i dont know any cpanel hosts but those are pretty damn specific xd
you want a free database
yes
Hello. Why my server motd is not displayed? Its bungeecord. I justused serverPing event
Sometimes it is, sometimes is not. Literally like once I click refresh on server list it sometimes shows up or sometimes not
This is just because of minecraft. This is no issue related to your server
nonono, not this lag. I mean, it loads up, however the motd is blank, or it works
It looks like this. https://i.imgur.com/RSeNRCd.png
You got any motd plugins?
I made one
Okay, can you show the code?
And when its fine its like this
sure I can gimme a sec
@EventHandler(
priority = 64
)
public void onServerListPing(ProxyPingEvent event) {
if (this.getConfig().getString("motd") != null) {
ServerPing ping = event.getResponse();
String motd = ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("motd"));
motd = motd.replace("{newline}", "\n");
ping.setDescription(motd);
if (this.favicon != null) {
ping.setFavicon(this.favicon);
}
String hovermsg = ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("hover"));
ping.getPlayers().setSample(new ServerPing.PlayerInfo[]{
new ServerPing.PlayerInfo(hovermsg, UUID.fromString("0-0-0-0-0"))
});
event.setResponse(ping);
}
}```
What is it with the priority?
Yes, but why do you need that?
If some other plugin such as NetworkManager decided to mess up, mine will be 1st
So the motd will be as it should be
@EventHandler(priority = EventPriority.HIGHEST)
Okay, so can you try changing your code so it only shows a small message
It loads up motd from config file
this.getConfig
I know
Oh, okay, didn't knew that
Try changing the motd to something simple without colours
and a short text, and check if it still gives issues then
very possible haha
what did you do?
Okay, try that
most likely there is a reason it got deprecated
Yeah, when I made this plugin it did not be though
Ah well, it works, that all that counts 😄
ah really?
no idea
anyone know how to remove this scaling information? https://imgs-i.sabel.dev/iunyKTr.png
what ive tried:
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES)((MapMeta) meta).setScaling(false)
neither remove that scaling information
yikes i swear ive seen on servers that some dont have that
yeah for example, even though this is a glitched item they were able to remove scaling information. I wonder how they did that? https://imgs-i.sabel.dev/ViHymdd.png
hmmm wait a minute that map is 358:126 while my map is only 358 maybe thats how you do it?
i mean item ids were discontinued though
Using outdated versions
Technically you can turn it off by disabling advanced item tooltips but that's probably not the solution you're looking for
I'd say nms
didnt even know that was an advanced tooltip thing but yeah thats not exactly what im looking for
the player inventory lost when i update the server from 1.15 to 1.16 ,anyone have the same problem and how to solve it?
@chrome lark Is this the same guy?
ye
Okay, sry for tag
Hey guys im trying to get custom loottable to work but its not going great everytime i try it it just do not work at all here is my code
LootTable
is adding enchantments to arrows as simple as casting Arrow#addCustomEffects() ?
wait i can't pull an itemstack from that
can i just add an enchantment to arrow itemstacks?
hey can anyone help me and see what is wront with my plugin?
package me.nary.helloworld.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.nary.helloworld.Main;
public class NickCommand implements CommandExecutor {
private Main plugin;
public NickCommand(Main plugin){
this.plugin = plugin;
plugin.getCommand("hello").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("Only Players May Execute This Command!");
return true;
}
Player p = (Player) sender;
if (p.hasPermission("hello.use")){
p.sendMessage("hi!");
return true;
} else {
p.sendMessage("You do not have permission to execute this command!"); }
return false;
}
}
What's the issue
package me.nary.helloworld.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;import me.nary.helloworld.Main;
public class NickCommand implements CommandExecutor {
private Main plugin; public NickCommand(Main plugin){ this.plugin = plugin; plugin.getCommand("hello").setExecutor(this); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)){ sender.sendMessage("Only Players May Execute This Command!"); return true; } Player p = (Player) sender; if (p.hasPermission("hello.use")){ p.sendMessage("hi!"); return true; } else {p.sendMessage("You do not have permission to execute this command!"); }
return false;
}}
@frigid ember you initialized constructor?
use Plugin
what does that mean
@frigid ember You have written "public NickCommand(plugin) ....".Have you instantiated this class somewhere? ex. new NickCommand(plugin)
idk
I don't really recommend passing the instance of your main plugin unless you have some fields or methods there
You could just pass "Plugin"
I see
I recommend doing this.
// Main class
public void onEnable() {
this.getCommand("hello").setExecutor(new NickCommand(this)
);
}
// NickCommand.java
public NickCommand(Main plugin) {
this.plugin = plugin
}
oh
where do i put that?
on you main class
edit
the one that extends javaPlugin
I recommend doing this.
// Main class public void onEnable() { this.getCommand("hello").setExecutor(new NickCommand(this) ); } // NickCommand.java public NickCommand(Main plugin) { this.plugin = plugin }
@digital cipher do what this man said
but where do i put that
also how do i do that little box thing you have
do i replace the entire main class with that?
put this on your main class method onEnable this.getCommand("hello").setExecutor(new NickCommand(this));
and edit your constructor in NickCommand.java
public NickCommand(Main plugin) {
this.plugin = plugin;
}
i have no idea what your talking about
package me.nary.helloworld.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.nary.helloworld.Main;
public class NickCommand implements CommandExecutor {
private Main plugin;
public NickCommand(Main plugin){
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("Only Players May Execute This Command!");
return true;
}
Player p = (Player) sender;
if (p.hasPermission("hello.use")){
p.sendMessage("hi!");
return true;
} else {
p.sendMessage("You do not have permission to execute this command!"); }
return false;
}
}
@Override
public final void onEnable(){
Bukkit.getPluginCommand("your-command-name").setExecutor(new MainCommand(this));
}
@Override
public void onEnable() {
this.getCommand("hello").setExecutor(new NickCommand(this));
}
And register the command inside the plugin.yml if you haven't already done it
i dont have a plugin.yml
lol
k
https://bukkit.gamepedia.com/Plugin_YAML
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/command/CommandExecutor.html
When Bukkit loads a plugin, it needs to know some basic information about it. It reads this information from a YAML file, 'plugin.yml'. This file consists of a set of attributes, each defined on a new line and with no indentation.
A command block starts with the command's na...
declaration: package: org.bukkit.command, interface: CommandExecutor
how do you do that box thing with the colors and stuff for java
?
no
@Override
public final void onEnable(){
Bukkit.getPluginCommand("your-command-name").setExecutor(new MainCommand(this));
}
@sturdy oar you need to use this in your main class
' ' '
`
Those are not backticks
what are they?
Backticks `````
package me.nary.helloworld.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.nary.helloworld.Main;
public class NickCommand implements CommandExecutor {
private Main plugin;
public NickCommand(Main plugin){
this.plugin = plugin;
plugin.getCommand("hello");
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("Only Players May Execute This Command!");
return true;
}
Player p = (Player) sender;
if (p.hasPermission("hello.use")){
p.sendMessage("hi!");
return true;
} else {
p.sendMessage("You do not have permission to execute this command!"); }
return false;
}
}
ooh
no colors tho 😦
without space
ok
i now have pluygin.yml
can someone call me ad ill share scree and ye but i wonnt talk
I can't I'm sorry
Just watch some tutorial
i am
Minecraft Hosting: http://pixelhost.org
We just expanded our website design services to Toronto Ontario, check out our brand new page for Toronto Website Design https://vervedev.com/toronto-website-design
In Episode 1 of how to make a Minecraft plugin we begin with the basic...
Do you already know Java?
no
That's the issue
a regular minecraft plugin looks like this
how do i learn java
a regular minecraft plugin looks like this
@digital cipher it's most common to have the plugin.yml inside a /resources folder
Viper only if you have a buildtool smh
Maven
or so
A plug-in?
how do i start to lern java?
This is good in my opinion
thx
There's an enormous amount of tutorial in that website, you probably don't even need them all
after you learn a bit of java, i would suggest this from CodedRed https://www.youtube.com/watch?v=r4W4drYdb4Q
Howdy all and welcome to my all-new series for Plugin Development! New videos every Monday. Join my discord for help and more :)
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers
Download Java Jre: https://www.oracle.c...
also i didnt know he is in this discord lol
not that hard to understand if you dont touch kotlin
I don't like some things about that tutorial tho
I don't like the fact that he is sending a link that links to an illegal website that redistributes spigot
oof, wait what
Look in his description
But above
wait is g*tb**k* illegal?
Yes
welp
Otherwise my message wouldn't be getting deleted
Also I don't really recommend installing Oracle JDKs
But that's a minor issue
how can i test multiple player plugins in a localhost?
how can i test multiple player plugins in a localhost?
@dusky sigil offline mode I guess
@sturdy oar elaborate?
server.properties => online-mode: false
Do you need lot of players to test your plugin?
2 or 3
You can just make some bots join I guess
its.. a localhost
yes?
Exactly
viper can i say the name of lam***at***k or not
they just have to execute commands
Wait
Yeah you can still do this with a bot or a offline mode account
Are you not allowed to download jars from websites
no
Nope
oof
k ill try
buildtools just builds it on your pc
sticking with paper then :))))
paper sucks
jeez
How come it’s not allowed
because minecraft
ah yes mc = uwu
5 min to use build tools is too much apparently
yeah
I can’t be bothered to build it on my computer then transfer it to pyterdactyl panel
wastes more time watching youtube, can't be bothered to start build tools meanwhile
👀
doesnt pterodactyl technically download it from a website?
Wdym
var mineflayer = require('mineflayer') var bot = mineflayer.createBot({ host: 'localhost', // optional port: 25565, // optional
username: user }) bot.on('chat', function (username, message) { if (username === bot.username) return bot.chat(message) }) bot.on('error', err => console.log(err))
nope nvm
Here a bot
you need something that has the best cpu freq per thread per price
also xqyc, ptero uses docker, why not just download an image and put it on ptero? https://github.com/nimmis/docker-spigot
true
how would i change the amount dropped from a block?
yeah thats what i saw on a thread
so like
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(event.getBlock().getType(), 6);
would drop 6 of the same block that was broken right
What event are we taking about
hello i have just started coding a minecraft plugin (and yes i have looked through the documentation and did watch some videos before i started) and i managed to make a plugin that when u type /hello it says hello back but when i put the plugin into my plugin folder i get a error saying invaild.yml so this is my code to my yml ``` main: me.EpicGamese.HelloWorld.Main
name: Hello
version: 1.0
author: EpicGamese
commands:
Hello:
Try deleting the new line between commands author and hello
Remove the space behind main
ok
And indentation should be two spaces, not a tab or 4 spaces
like this main: me.EpicGamese.HelloWorld.Main name: Hello version: 1.0 author: EpicGamese commands: Hello:
the space of main is not in my editor
You probably need to also add a description to the command
ok
i typed a description an when i put basic hello world plugin there is a red line under plugin and it says plugin not curently spelled
sure
name: Hello
description: Basic hello world plugin!
version: 1.0
author: EpicGamese
commands:
Hello:
main: me.EpicGamese.HelloWorld.Main
name: Hello
description: Basic hello world plugin!
version: 1.0
author: EpicGamese
commands:
Hello:
usage: /<command>
I meant like that
eclipse says otherwise xD
pretty sure eclipse also says it lol
i just got warned for spamming lol
autocorrected "testplug" to "Testplug" so
curious
@torn robin sorry i didnt see your message i was talking about blockbreakevent
I know it warns you when you're creating a package
so like
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(event.getBlock().getType(), 6);
would drop 6 of the same block that was broken right
it loaded the plugin but it says you do not have perms
give yourself op then
yes that should drop 6 of the same block that was broken
i do have op @sinful spire
What command are you running, and what's your command source (class file)?
do you have any permission plugin?
nope
uhh are u asking me about the command @torn robin
no Atin diff person
oh ok
yes that should drop 6 of the same block that was broken
Yeah thank you
the code you gave should do what you asked
Yes okay
👍
instead of 6 if i add Random.nextInt(1000) it will drop a random from 0 to 1000 blocks right?
i fixed my issue thanks guys
glad to hear it
replacing new ItemStack(event.getBlock().getType(), 6) with new ItemStack(event.getBlock().getType(), ThreadLocalRandom.current().nextInt(1000)) would be better
TLR should be preferred over new Random() for complicated thread reasons
the max might be capped at 64 though, not sure
The class itself is static (part of why it's safer for multithreads probably) so no
Okay so, the issue I have rn with GriefPrevention is that anything I try to spawn inside a claim disappears immediately, some examples:
- When a MobSpawner is placed inside a claim, it shows the "fire" particle that suggest it spawned the mob, but you can't see it, it instantly dissappear (but the tick that spawns the mob executes).
- When spawning anything inside a claim using an Egg, happens exactly the same. Trying with Cow Eggs, you can hear the sound of the cow when it spawns, suggesting that the spawn tick executed, but it disappears immediately and you can't see it.
- When trying to procreate animals, same happens
- Is happening even with armor stands (that as far as I know counts as entity spawn as well)
You can do something like
ThreadLocalRandom random = ThreadLocalRandom.current();
System.out.println("?: " + random.nextInt(50));
How long has this issue been occurring? Have you changed anything server wise (Plugins, configs, permissions, etc.)?
not sure which is better threadlocal or secure random 🤔
OKay thanks msws
yep yep
I'm pretty sure secure random is for passwords and stuff
no idea what the differences are
Weeks by now, and seems to happen since my server opening, I just didn't notice it because I didn't test-play that long, just maked sure that everything worked, commands n that kind of stuff
If you disable GP does the issue still occur?
If possible I'd still like to confirm it's caused by GP
it's likely a GP configuration then? have you looked at those?
yup, there's nothing related to spawn
Hm, I unfortunately don't know then. If they have a discord/support system then I'd use that.
players.compute(uuid, (key, value) -> new Data(e.getEntity().getLocation(), e.getDeathMessage(), LocalDateTime.now(ZoneOffset.UTC).format(formatter))); can this actually be done in a hashmultimap
To make it UUID, Data
And 3 things are stored in data via my Data.java class
Hi, is there a way to download part of a server map? I have 200gb map and I want to only download the 2k spawn radius (to use in single player)
UwU
Hi, what Event Listener should I use when I want to listen when a Bell is activated by redstone? Thx in forward...
was I just kicked off the server?
BlockPoweredEvent i think
o, server must've reset or something
ok
@paper compass that doesn't exist. there is BlockRedstoneEvent, but that only works for redstone emiters (like redstone, levers, ...)
ah
or is there no way to check generally if a bell was triggered
why use
commands:
test:
usage: /<command>
in plugin.yml if you could just do
usage: /test
i did it but it doesn't work
hm
like this
i tried that but doesn't work
Weird
the word is still red
but when i type /version SimplyLock it's able to read the content in my plugin.yml
ohh i found the problem
finally
because i was using plugman to test
i need to reload it in order to get the suggestion
so if i have an argument i can just change the usage to usage: /lock <name>?
why is my server crashing, if i try to generate trees?
the error: https://hastebin.com/hiqupomimo.md
Random randomTree = new Random();
int randomTreeInt = randomTree.nextInt(100);
if (randomTreeInt <= 20) {
world.generateTree(new Location(world, x, y + 1, z), TreeType.TREE);
why did you declared that if you only use it once?
declared what lol
i dont think thats the cause for the crash...
so use this?
int randomTreeInt = new Random().nextInt(100);
even better Math.random() <= 0.2
dataMap.get(uuid).getLocation().getWorld().getName()```
I cant get the loc of a players uuid
how would I convert it from uuid to player again :/
your server seems to crash on world load
yep
is it loaded?
on creating
than I provide player instead of uuid
try generating a tree after the chunk loaded
[14:01:35] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[14:01:36] [Server thread/INFO]: Preparing start region for dimension minecraft:test
[14:01:36] [Worker-Main-15/INFO]: Preparing spawn area: 0%
[14:02:39] [Spigot Watchdog Thread/ERROR]: ------------------------------
[14:02:39] [Spigot Watchdog Thread/ERROR]: The server has stopped responding! This is (probably) not a Spigot bug.
[14:02:39] [Spigot Watchdog Thread/ERROR]: If you see a plugin in the Server thread dump below, then please report it to that author
[14:02:39] [Spigot Watchdog Thread/ERROR]: *Especially* if it looks like HTTP or MySQL operations are occurring
[14:02:39] [Spigot Watchdog Thread/ERROR]: If you see a world save or edit, then it means you did far more than your server can handle at once
[14:02:39] [Spigot Watchdog Thread/ERROR]: If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash blablablabla
or i did
lol
nah I just didnt say it correctly
so my hashmap is uuid
and I need to get the information about the uuid
dataMap.get(uuid).getLocation().getWorld().getName()
but I cant get the location of a player's uuid
so what should I do to do this :/
dataMap.get?
Multiple things
Data class
wow my first time generating a custom world an the server crashes... lmao
so one is location, one is string, one is string
yeah thanks anyway
yes
uuid of sender
the world he previously died in that is stored in the hashmap as location
maybe i am doing something completely wrong
Player player = (Player) sender; UUID uuid = player.getUniqueId();
thats done
I need to get the info of the player's uuid out of the hashmap
but getLocation can't be done to an uuid
map.get(uuid)
What does the map contain
what’s in your data class?
uuid, data
?paste
Does data have a getLocation method
player.sendMessage(applyCC("&6World:&f " + dataMap.get(uuid).getLocation().getWorld().getName()));
and what’s the problem?
this doesnt work
ohh maybe its the for-loop
4
Cannot resolve method 'getLocation' in 'Set'
for (Map.Entry<UUID, Data> plInfo : dataMap.entries()) {```
HashMultimap<UUID,Data> dataMap = HashMultimap.create(1, 5);```
Multimap value is Collection
Multimap<UUID,Data> dataMap = ArrayListMultimap.create();
dataMap.get(key); // return Collection<Data>
Why not use a standard hashmap
I have to send the message over multiple data stored of that uuid
Then loop through the returned collection
maybe he needs a multi map
yes I do
you can do so
for(Data data : dataMap.get(key)) {
// do something else
}
Hello. Does the EZPlaceholderHook still exist?
how can i FULL delete a project in intellij? it just deletes the modules
yeah
i am using eclipse for forge development... and its so freaking weird for me. no automatic autocorrect/method help etc
so weird
lmao
Just delete it from the disk and hit the remove button or whatever
IJ doesn't have a "delete this project" thing afaik, nor does visual studio last I recall, etc, etc
don't recall there being a delete button
Well its not difficult
New -> Recent projects-> manage projects
Thats where there is a X
Yea, that's not a delete button
That just removes it from the recents, not actually deletes it
Ahh
I usually don’t need to remove it
Nah make a new project of it
how can i use the onBlockPlace event?
wdym how can you use it?
make a listener class that listens for BlockPlaceEvent and it’ll be called whenever a block is placed by a player.
declaration: package: org.bukkit.event.block, class: BlockPlaceEvent
Can someone tell me how can I remove mobs from spawning in a minecraft world with worldguard or multiverse core but keep spawners working?
use gamerules on certain worlds with multiverse
@scarlet nova do a little research before asking your question, https://www.spigotmc.org/threads/help-disabling-mob-spawning.22740/
how do I get the list of players on a bukkit server I can't find anything helpful
Bukkit.getOnlinePlayers
ty
Question, what is the correct approach for storing a reference to a world? When I used a property World, for one server, it gave back null. And I'm certain that the world was actually correct.
So more specific, in which cases will an earlier reference to a world interface return null?
How does one remove the square brackets around a TextComponent ?
For some reason it is adding them on its own
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
TextComponent message = new TextComponent(TextComponent.fromLegacyText(colorise(EventUtils.parsePlaceholders(locale, locale.getDiscordDefault()))));
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, locale.getDiscordLink()));
sender.sendMessage(message);
return true;
}```
declaration: package: org.bukkit, class: Bukkit
Would MySQL Inventory Bridge work with MySQL express?
Does anybody know how to possibly remove prefixes from display names in Essentials so they are not visible in BalTop? I have only seen 1 forum surrounding it and I did not fully understand.
You can just delete the module then delete the files/folder
requires hitting delete twice
hey
@gilded compass try sender.spigot().sendMessage(message); If that doesn’t fix it it’s something you’re doing that’s adding them
How does one remove the square brackets around a TextComponent ?
@gilded compass probably some other plugin interfering? a textcomponent should be sent exactly as it is
EDIT: how can you even send that without using .spigot()? I thought bukkits sendMessage only accepts Strings. IntelliJ never let me do that without using sender.spigot()
if lets say, i have a bungeecord server but for each server ill make a plugin, can i just code the plugins in Spigot and not bungeecord?
i have a problem. it gets an error, saying "z out of range, expected 0-15, got -36". why?
Spigot plugins are different from bungee plugins. So yes.
its btw the exact example from the wiki lol
Spigot plugins are different from bungee plugins. So yes.
@opal adder Thank you
How come some plugins are universal?
Meaning?
how do they do that
Probably that they work on both spigot and bungee
Do what
i think he means compatible for multiple versions
yes
They make them compatible for multiple versions
...
lol
how do they do that
@distant rapids how
is PlayerResourcePackStatusEvent ran async?
This supports 1.5 -> 1.16+ via reflection https://www.spigotmc.org/resources/twerktree.35496/
is there a method to send an action bar to a player without NMS? (1.12.2 api)
Don't think so
if(server.getVersion().equals(1.14)){
//1.14 code
} else if(server.getVersion().equals(1.15)){
//1.15 code
}
etc
so I'd have to use NMS?
btw thats no working code lol
better question, is there a bukkit tool to async check?
whot
i wanna check if an event is async
the event has a method for that
is there a method to send an action bar to a player without NMS? (1.12.2 api)
@lapis plinth idk if that works for 1.12 but
players.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));
this would be supposed to trigger then
i guess is sync
lol
i'm out of words then
hamsterapi is crashing for some reason from this event
👀
the devs keep pointing at me
all i need to break his plugin is to
for some reason 😂
intellij has them too
just smarter and less visible
they are lines i think
you know to keep your code aligned
you get used to it
lmao
this is way too clean
i have a problem. it gets an error, saying "z out of range, expected 0-15, got -36". why?
https://hastebin.com/odogobazen.java
@tough kraken 😦
is it a chunk
Chunk blocks go to 0-15
Since you know a chunk is a 16² square with 256 height
yeah
How do I code something like watchdog on my Minecraft server to prevent hacking
With java?
here we go again
tbh thats just copied from the wiki... so if it doesnt work they made something wrong lol, or i am totally dumb
wouldnt be a wonder
Bruh what are the basic commands
If you don't have +3 years with Java and good physics / statistics knowledge don't ever consider writing anticheats
Rip I can have my cousin do it ig
anticheats are harder to code, than break them
I can only write Reach/HitBox checks so far 😢
i can not even do THAT lol
clickspeed check shouldnt be so hard as well i think
but idk
The main issue and annoying thing is to consider about server lag and player latency