#help-development
1 messages · Page 2189 of 1
ooooooohhh I though you meant Private Plugin MCBrawl. it's actually Private MCBrawl plugin
that's why
I solved the plugin error, but I still have the runTask error
why would you do this
oops sry, meant private
Tbh it doesn't matter although if you're not experienced, you'll abuse this making your code cluttered. You may end up having schedulers in data classes and whatnot
Dependency injection is better because it makes you think about where you're passing your plugin instance
I would like to specify the ticks, how can I solve that runTask error?
if you want to use a real singleton, use JavaPlugin#getPlugin, dont use instance unless there is no better way
^
runTaskLater
it accesses your main class with one instance without any problem
Dependency Injection > that
yeah, well its better because of a lot more than just that tho
^
For a spigot plugin?
works great, really appreciate the help everyone, I will test it and see what happens
thats what she-
it's object oriented language, only things that needs to be static are those who doesn't need to be duplicate
There's only supposed to be one instance
Yeah i agree but if you have access to your plugin eberywhere, it can lead to messier code
You'll have to know when not to use it
@iron glade you understand that you can only have one JavaPlugin class, so it can be static, right?
well ideally you should rarely have to pass your plugin instance in a spigot plugin minion, unless the api demands you to, but even then its better to create middle level facade classes and pass instances of those
I did never say that it can't be, just saying DI is the better thing in this case
I know, but it takes up unnecessary memory (that's not the main problem as it's not too much), and you need to have JavaPlugin instance in every class where it is needed, static approach is better when you just need it once in one class, but DI is better when you need to access it more than that
package com.cyan.elytrarace;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin {
@EventHandler
public void onPlayerUse(PlayerInteractEvent event){
Player p = event.getPlayer();
if(p.getItemInHand().getType() == Material.PHANTOM_MEMBRANE); {
p.teleport(p.getLocation().add(0,200,0));
?paste
.
can someone help me i just cant figure out why it wont teleport me
Your class doesn't implement listener
And u need to register your listener in onEnable
?
Doing Plugin.getInstance it very long though
Esp if you have a long plugin name
Very wordy to have in ur code
So u may want to store a plugin instance in the class
And you're back to storing the instance
this is invalid
By that logic all manager classes should be static
unnecessary memory
you're literally storing a reference which is 8 bytes in the JVM
why?
oh yeah
Can you do it Im very bad i cant do it
myeah the entire one instance <=> singleton argument doesnt work anymore since its been proven to degrade code architecture
Sorry I'm not sitting at your keyboard
Those are the basics, they're out there in the internet everywhere
Because access is too easy right?
1st how much memory it takes when you would have 1000 classes that holds the JavaPlugin reference, and then read my argument again and you can maybe see that I wrote that (that's not the main problem as it's not too much)
1000 classes kekw
I have question, would you guys think it'd be possible to make unicorn? (lets say riding a horse flying in the air, when u try to make it jump it goes higher, to make it go down u click in the direction of the horse)
static approach is better when you just need it once in one class
still no
people be rewriting whole minecraft? xd
8kb
static should be used for global, stateless and arguably pure stuff
^ this
also when you use static, it's not like you aren't using memory
you still need to store, in the constant pool, the field reference
which requires the signature as a utf8 string
or the method reference for the static getter, same situation
🤓
Uh, it is a bit larger than that ... quite a lot larger I believe
No it's not
a reference is 8 bytes
when you store an object in a variable, you aren't storing the object itself
you're storing a reference to that object
hey guys, this time for some reason the player is being knocked to a wrong direction after the heatValue exceeds 8, even though I'm LITERALLY using the same math, any ideas why? cpp @EventHandler public void onPlayerHitPlayer(EntityDamageByEntityEvent event) { if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) { heatValue++; LivingEntity damaged = (LivingEntity) event.getEntity(); LivingEntity damager = (LivingEntity) event.getDamager(); Vector damagedV = damaged.getLocation().toVector(); Vector damagerV = damager.getLocation().toVector(); damaged.setVelocity(damagedV.subtract(damagerV).normalize().multiply(heatValue)); if(heatValue >= 8){ Bukkit.getScheduler().runTaskLater(plugin, () -> {}, 20); damaged.setVelocity(damagedV.subtract(damagerV).normalize().multiply(heatValue)); }
Yeah, I think I confused those two
that's why you can pass an object through a method and manipulate the object from the method
i mean why are you passing an empty runnable
use the same vector in your runnable
quite a lot larger would be >8 bytes, the only other case is 4 bytes on a 32-bit machine, which is less?
but i have a question. will there be any problem if i just transferred build tools from my virtualbox ubuntu into my main windows@tender shard
Or better said treated them the same
should work fine
alright 👍
:3
Clone the vectors before adding or subtracting
Which means that I treated an reference to be 50 - 120 (not sure what the exact size was but eh) bytes in size
You're reusing the vectors which had math done on tjem already
what purpose does that serve?
oooh
:? definitely not but all right then
Or save the calculated vector to a Vector variable and just set that as the velocity
how can i post it?
copy the link up the top after you paste it
I'm already doing that, do I make a new vector now?
You're not saving the calculated vector
nor are you registering it
?wiki
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so like that? ```cpp
@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
heatValue++;
LivingEntity damaged = (LivingEntity) event.getEntity();
LivingEntity damager = (LivingEntity) event.getDamager();
Vector damagedV = damaged.getLocation().toVector();
Vector damagerV = damager.getLocation().toVector();
Vector velocity = damagedV.subtract(damagerV).normalize().multiply(heatValue);
damaged.setVelocity(velocity);
if(heatValue >= 8){
Bukkit.getScheduler().runTaskLater(plugin, () -> {damaged.setVelocity(damagedV.subtract(damagerV).normalize().multiply(heatValue));}, 20);
}
}
}
Can you please just tell me how instead of posting links to some websites
tf never seen someone do that
Yes
Can you click the links and read them instead of asking us to do it for u?
could someone tell me why is this null?
Put it outside your onEnable part and let the class implement listener, then register it in your onEnabe
What is null?
?di and no public variables x)
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
because the return value of "me.fragment.skyblockplugin.files.IslandManagerFile.getCustomFile()" is null
it might be a package private field
Well look at your getCustomFile method then
its just a guide on how to set everything up i dont need that i just need help with my program
it's working, when i did that method is when the problems started
saw
Learn java basics and u won't have to ask us stuff like this
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
the event is red? whut?
Huh?
getCustomFile is null
I mean, getCustomFile works in other things
That's your error, figure out why it's null
yeah I know I just wonder about the description "now the event is red"
like wtf is that supposed to mean
he is metaphorically describing the state of his event
im already learning java, its just that im not so far but my dad wished for his birthday that im coding something for him im sorry
He wants a mc plugin?
no he wanted that i code a minigame for him he can play
Any idea why the runnable code sends the player so damn high up in the opposite direction?
@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
heatValue++;
LivingEntity damaged = (LivingEntity) event.getEntity();
LivingEntity damager = (LivingEntity) event.getDamager();
Vector damagedV = damaged.getLocation().toVector();
Vector damagerV = damager.getLocation().toVector();
Vector velocity = damagedV.subtract(damagerV).normalize().multiply(heatValue);
damaged.setVelocity(velocity);
if(heatValue >= 8){
Vector velocity2 = damagedV.subtract(damagerV).normalize().multiply(heatValue);
Bukkit.getScheduler().runTaskLater(plugin, () -> {damaged.setVelocity(velocity2);}, 20);
}
}
}```
because thats the main reason i was allowed to get a pc, that i would code
I mean, don't know what your heatvalue is
but it is incremented by 1
velocity is pretty sensitive
a value that gets higher each time the player is hit so that it pushes the player further away
code a celcius/ fahrenheit converter lol
the world is heating up 🥺
a vector of like length 3 is already a lot of velocity when applied to a player
did you even read my messages?
if e.g. the damager and target are 3 blocks apart
if you multply that by like 3
things will get insane
I've tried stupid amounts, it always only knocks the player back 18 blocks and not any further
gonna keep it real with you a minigame is NOT how you begin coding
didn't we already tell you to use a cloned vector of the original vector you used in the first aplace?
its just that it teleports the player up
why are you doing math on it again? makes no sense to me
aren't velocity1 and velocity2 clones?
no
or isn't velocity2 a clone of velocity1?
velocity2 is damagedV.subtract(damagerV).normalize().multiply(heatValue);
it has nothing to do with velocity(1)
wouldn't that be the same as Vector velocity2 = velocity1
what's cloning then?
what the diff btween locatin and vector?
Oh ok
and then obviously methods are different
try sth like this
@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
heatValue++;
LivingEntity damaged = (LivingEntity) event.getEntity();
LivingEntity damager = (LivingEntity) event.getDamager();
Vector damagedV = damaged.getLocation().toVector();
Vector damagerV = damager.getLocation().toVector();
Vector velocity = damagedV.subtract(damagerV).normalize().multiply(heatValue);
damaged.setVelocity(velocity.clone());
if(heatValue >= 8){
Bukkit.getScheduler().runTaskLater(plugin, () -> {damaged.setVelocity(velocity.clone());}, 20);
}
}
}
it doesn't have to be a final right?
no
btw I fucking hate spoons
thx
I think the final modifier appear when you decompile a jar
we talkin spaghetti or just the small pasta?
because I don't like mutable stuff
void
any kind of pasta
conclure
till not understand why the socket input send a number 3 to console
Is an id or what?
might be
wat
what socket input
oh were you writing your "fake client"
or was that someone else
its him
yes
sorry to break it to ya but here in the east if you eat anything but dessert or spaghetti with a fork, you are a weirdo
can PersistentDataContainer store data across restarts? I'm using it to store player configs.
Im connecting a fake client to server, doing handshake and login packet. After that i read socket input
yes
And display a number 3 to console. So i dont knon what means that number 3
it indeed does store across restarts
thats the point of that thing hence the prefix Persistent
yes, that's why it's called Persistent
and not Volatile
You're doing the same thing
Reuse velocity
how can i do something every 1 second white an integer is not 10
what
?scheduling
I don't think I'm using persistent data container correctly
i know how to do something every 1 second
but how can i do it somehow like this
then you also know how to do something every 10 seconds
but i don't want to do that
oh my bad
I read it incorrectly
wait wtf is your code doing? you are creating like 36 runnables
How do iread that
Im already reading input stream, but debugging to console it send a mumber "3"
i know that it's incorrect but i just want you to understand
so you can give me the real code
yeah but what are you trying to do after all?
trying to read the server responses
you have the "run()" method. just put inside the code you want to run every second
I was talking to canable. I have no idea about protocollib, it sucks imho
Oh sorry mfnalex, i get confused
Nott either protocol lib hahhaa
IT FINALLY WORKS LIKE I WANT IT TO LESSGOOOOO
what did you do? replace the vector with clones as I said?
yup
wouldn't just reusing the velocity work?
why clone
I see
so you want to create your vector once and then use a clone every time to reset the velocity
welp now, how do I make the heat value different for each player and not static for the whole server like it is right now
I certainly can't add a variable to the player class
do I make a child class of player, add the heatValue and use that?
or is there an easier way?
just a Map<UUID, int>
what's that if you don't mind me asking
I know what's a uuid and the int here is my heatValue
but what's Map
oh wait I took that in java 3
that's a generic?
lemme google and see :P
@tender shard
@EventHandler
public void e(PlayerQuitEvent e) {
Bukkit.getConsoleSender().sendMessage("logout " + e.getPlayer().getPersistentDataContainer().getKeys().size()+"");
}
@EventHandler
public void e(PlayerLoginEvent e) {
e.getPlayer().setPersistent(true);
Bukkit.getConsoleSender().sendMessage("login 1 " + e.getPlayer().getPersistentDataContainer().getKeys().size());
e.getPlayer().getPersistentDataContainer().set(ACTIVE_PROFILE, PersistentDataType.STRING, "test");
Bukkit.getConsoleSender().sendMessage("login 2 " + e.getPlayer().getPersistentDataContainer().getKeys().size());
}
On the first login, I'm setting persistent data, and when I logout, the persistent data is not being saved, so when I login again, the data isn't there. Am I missing something?
do you know skript ?
lol
yes, it's this weird plugin that allows people to write shitty plugins without java
yes
Sounds like Denizen
but do you remember the line that can hold the event or the command for a couple of seconds
like
wait 3 seconds
?scheduling
how to do it in java
oh didnt see you asked, but basically
- what if the singleton class requires dependencies on creation
- classes that depend on that singleton class are gonna tightly depend on a single unit, this is known as tight coupling and makes it a hell to organize and test
- using singletons insinuates your code with hidden dependencies, which makes the code hard to test (unit test particularly)
- how do you manage creation, usage and deconstruction of the singleton in a multi threaded environment
- how do you manage to change behavior without modifying it? (open closed principle)
- you lose dependency inversion and inversion of control to most extent with singletons
(of course there are some advantages)
- globally accessible, sometimes advantageous, like when you want to provide an api
- sometimes a good and defensive pattern to manage expensive objects
System.out.println("This runs now");
Bukkit.getScheduler().runTaskLater(this, () -> {
System.out.println("This runs one second later");
},1*20L);
1*20 = one second because minecraft has 20 ticks per second
sleep(900000)
bro don't put them into a coma
package me.oliver193.mecha.Commands;
import me.oliver193.mecha.Msg;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Heal implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.")
return true;
}
Player player = (Player) commandSender;
player.setHealth(20);
Msg.send(commandSender, "&aYour health is now full.");
return true;
}
}
``` so this?
that looks perfect
"why is my server crashing???": sleep(900000)
someone doing while loop in event
oh yeah
seems your convention on everything else is good though
package names should be lower case although ti actually doesnt matter
isn't "to crash" actually slang for sleeping lol
how do i convert unix time to yyyy-mm-dd HH:mm?
SimpleDateFormatter
can u provide an example pls?
Hey Guys I want to add Every Player Except 1 Player to an Array List How can I exclude that 1 player
oh yeah forgot a ;
wow
Or add all but that player
sth like this should do
SimpleDateFormat format = new SimpleDateFormat("%H:%m:%s");
System.out.println(format.format(new Date()));
package me.oliver193.mecha.commands;
import me.oliver193.mecha.Msg;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Heal implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.");
return true;
}
Player player = (Player) commandSender;
player.setHealth(20);
Msg.send(commandSender, "&aYour health is now full.");
return true;
}
}
``` thats perfect?
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date fromUnix = new Date(unixTimestamp);
System.out.println(formatter.format(fromUnix));
you can use Msg.send(player, "..."); btw
without a cast
ty
it doesn't matter whichever you use, but you don't need to cast player in Msg.send() because the method accepts a CommandSender
yeah @jagged quail EVERYTHING that is a player is also a CommandSender because Player extends CommandSender
well perfect is subjective
this is his first plugin so I'd call this "perfect" for their first plugin
time to fix this ```java
package me.oliver193.mecha.commands;
import me.oliver193.mecha.CommandBase;
import me.oliver193.mecha.Msg;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Feed {
public Feed() {
(new CommandBase("feed", true) {
public boolean onCommand(CommandSender sender, String[] arguments) {
Player player = (Player)sender;
player.setFoodLevel(20);
Msg.send((CommandSender)player, "&aYour hunger is now full!");
return true;
}
public String getUsage() {
return "/feed";
}
}).enableDelay(2);
}
}
yeah get rid of that ASAP lol
compared to that, it's perfect lol
not even a functionalinterface
those "essentials-like" plugins are actually the best to learn spigot api imho
wait wha Msg.send((CommandSender)player
yeah
yeah shush that's his old code lol
package me.oliver193.mecha;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class Msg {
public static void send(CommandSender sender, String message) {
send(sender, message, "&a");
}
public static void send(CommandSender sender, String message, String prefix) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + message));
}
}
its ok now?
@jagged quail imagine you have the following class structure:
LivingThing -> Human -> German
so every German is also a Human and every Human is also a LivingThing. If you now have a method that requires a Human you can of course also always pass a German, since every Germa nis a Human. But you cannot pass a LivingThing because not every LivingThing is a Human (animals, mushrooms, plants, ...)
that's why casting Player to CommandSender is useless
heal is green but feed is blue
that's git
vcs
git moment
because you changed something in the one file
technically you could make the method 5 lines shorter
just ignore it
if perfect is defined by shortest amount of lines
commands are color coded to what they do
technically one could also make it 89 lines longer 😛
true
I'm so helpful
or just remove all the newlines and have a one line file
yeah I once coded AngelChest in 5 lines
the rule was "no more than 3 semicolons per line"
time to fix this ```java
package me.oliver193.mecha;
import me.oliver193.mecha.commands.Feed;
import me.oliver193.mecha.commands.Heal;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
public void onEnable() {
instance = this;
getLogger().info("Mecha version " + getDescription().getVersion() + " is loading");
new Heal();
new Feed();
}
public void onDisable() {
getLogger().info("Mecha version " + getDescription().getVersion() + " is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
make Msg.send always throw an exception to avoid returning true 😎
no 🗿
exceptionsort on top
Hey guys, I'm trying to stop villagers from discounting (when getting converted.) How would I go about changing this?
@tender shard how would i make it load the commands now sorry
load the commands? you mean registering them?
yeah
class Mfnalex extends german
my brain isnt braining
getCommand("heal").setExecutor(new HealCommand());
in your onEnable()
also you have to add the "heal" command to your plugin.yml
in plugin.yml:
commands:
heal:
description: "Heals the player"
My eyes
also cleared it up by removing version ```java
public void onEnable() {
instance = this;
getLogger().info("Mecha is loading");
new Heal();
new Feed();
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}```
the rules are: no more than 3 ; per line lol
why setting a system property?
should rename the command java file to HealCommand from Heal
yes
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
😛
okay this is the plugin.yml
name: Mecha
version: '${project.version}'
main: me.oliver193.mecha.Mecha
api-version: 1.18
authors: [ oliver193 ]
description: Mecha Plugin
website: https://github.com/oliver193/Mecha-Plugin
commands:
heal:
permission: mecha.heal
description: Heal yourself.
usage: /heal
feed:
permission: mecha.feed
description: Feed yourself.
usage: /feed```
so that should work hopefully
looks good
should get rid of this
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
public void onEnable() {
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
}
``` main file looking good
if you don't need it
but I'd keep it because some time you WILL need it
there are probably some people here who want to talk you into DI instead but
(I wouldn't listen to them)
lol
oh i'll add it back
I always do it like this
public class CBDTest extends JavaPlugin implements Listener {
private static CBDTest instance;
{
instance = this;
}
public static CBDTest getInstance() {
return instance;
}
}
oof
add this
{
instance = this;
}
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
public void onEnable() {
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
^
show a full screenshot
oh needs to be in onEnable
no
onEnable is way too late to set your instance
you want to set it as soon as it's created (in the constructor)
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
public void onEnable() {
instance = this;
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
{
instance = this;
}
public void onEnable() {
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
like this
ah
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
{
instance = this;
}
public void onEnable() {
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
``` done
{
}```is the same as a no argument constructor
@tender shard as long as you set the instance before anything gets it, it's all good
The top of onEnable or even onLoad is fine
like this?
Yep
let me build and test it
no
that's wrong
{ } gets added to EVERY constructor
what
Hello! I'm trying to solve a problem but I haven't figured out how...
Basically I'm getting this as null: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.file.FileConfiguration.contains(String)" because the return value of "me.fragment.skyblockplugin.files.IslandManagerFile.getCustomFile()" is null
and this shouldn't be null as i'm doing this:
(main class)
public IslandManagerFile islandFile;
(on enable method)
this.islandFile = new IslandManagerFile(instance);
somebody told me otherwise
it's used to share code between all constructors
but nice
hey guys, how do I set a non-static int to all players? if you've been following with my Knockback plugin, then I want to make the heatValue for each player and not global like it is right now
ok thats good
public class Test {
{
System.out.println("Test");
}
public Test() {
}
public Test(String asd) {
}
public static void main(String[] args) {
new Test();
new Test("asd");
}
}
this prints "Test" twice
why?
maybe other plugins need your instance before your onEnable ran
yea looked it up that's how it works
then set it in onLoad
maybe other plugins need your instance before your onLoad ran 😛
well
then fuck those
^^^^ it's called using depends in plugin.yml
anyway can't hurt to set it as soon as possible
does someone know how to solve that?
then add as a depend in the plugin accessing
Send your IslandManagerFile.getCustomFile() method. Whatever that is returning is null, you probably forget to set it when you instantiate IslandManagerFile.
public FileConfiguration getCustomFile() {
return customFile;
}
there is no reason to delay setting the instance to "this". One should do it as soon as possible, no matter when you need it.
im guessing that the build time varies on how much load the system has
it makes no sense to wait until onLoad to set the instance
customFile is null
ehm
yeah I also do it this way, but if you do it right it won't matter
shouldn't be
yeah true. doing it in onLoad should be fine but I just don't see any reason to not do it in the constructor
before i did the IslandManager class it worked
it is
It doesn't matter whether u thinknit should or shouldn't
also I like the { } syntax because it confuses total bneginners lol
static { } is also awesome
Well where are you setting customFile?
xD you monster
anyway
gonna upload the updated version to github
using ConfigurationSection#get(String) on this```yaml
object:
- a: 1
b: 2 - c: 1
d: 2
(or is it because it needs a parent?)
and then in OnEnable method
static { is so awesome, for example for stuff like this
public class AdvancementInfo {
private static final Class<?> CLASS_CRAFTADVANCEMENT;
private static final int MC_VERSION;
static {
Class<?> tmp = null;
try {
tmp = getNMSClass("org.bukkit.craftbukkit", "advancement.CraftAdvancement", true);
} catch (Exception ignored) { }
if(tmp == null) throw new NMSNotSupportedException();
CLASS_CRAFTADVANCEMENT = tmp;
MC_VERSION = McVersion.getMinor();
}
.
bc ConfigurationSection has many useful methods
@tender shard https://github.com/oliver194/Mecha-Plugin update version up now
loop over all players
wdym?
what didnt you understand?
loop what?
oh shit i left the old heal in the plugin
Bukkit.getPlayers()
well yes but how do I set them the int?
what int? do you have a hashmap or sth, or what?
so what "int" are you talking about
heatValue
I want each player to have a unique one
if you want to attach a value to a player you can use nbt, or keep track of every player's value using a Map<UUID, Integer>
private final Map<UUID,Integer> heatMap = new HashMap<>();
what should i call the Gamemode java file
if you don't understand this, then google what a map is
because GamemodeCommand.java seems like a long name
no it's a fine name
ok
I'd call it
com.jeff_media.pluginname.commands.GamemodeCommand
you could create a static method that turns a Map<String,Object> into a ConfigurationSection
I'll show you in a minute
I can't find the deserialization methods bukkit uses
public static ConfigurationSection fromMap(Map<String,Object> map) {
ConfigurationSection section = new MemoryConfiguration();
for(Map.Entry<String,Object> entry : map.entrySet()) {
section.set(entry.getKey(), entry.getValue());
}
return section;
}```
like this
can I use Player instead of UUID?
yes but you shouldn't
because when a player rejoins, the Player object is invalid
you should really use UUIDs
okay so i need to figure out to tell what a string is saying
Player is temporary
explain a bit further pls
okay so
your onCommand methods has a String[] args
args[0] will be "c" if they enter "/gamemode c"
example:
/somecommand my name is jeff
then
args[0] = "my"
args[1] = "name"
etc
have this so far:
package me.oliver193.mecha.commands;
import me.oliver193.mecha.Msg;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class GamemodeCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String [] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.");
return true;
}
Player player = (Player) commandSender;
}
}
need to remove the space in between String []
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String [] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.");
return true;
}
Player player = (Player) commandSender;
String targetedGamemode = args[0].toLowerCase();
switch(targetedGamemode) {
case "c":
case "creative":
// set to creative mode
break;
case "s":
case "survival":
// set to survival mode
break;
// etc...
}
}
I do want it to reset after the player leaves or if the server restarts, I even will make a listener to make it reset after a player's death
also be sure to check that args.length is at least 1 before accessing args[0]
you should still use UUIDs
I do have to write a listener for when the player leaves or the server stops right?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
"strings"
ah
check if there is a args[0] so if args.length > 0
i just needed to change it to strings
ye but if the used did /gamemode it will throw an ArrayOutOfBoundsError
lol just check the length of the args array
lol my server has the first version aka the worst
if (commandSender.hasPermission("mecha.heal")) {
player.setHealth(20);
} else {
Msg.send(commandSender, "&4You do not have permission to run this command.");
}``` this should work
fingers crossed
gonna test
Msg.send is my class to translate colour code
package me.oliver193.mecha;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class Msg {
public static void send(CommandSender sender, String message) {
send(sender, message, "&a");
}
public static void send(CommandSender sender, String message, String prefix) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + message));
}
}
and it accepts a commandSender
alr
should work as long as your commands are setup right
name: Mecha
version: '${project.version}'
main: me.oliver193.mecha.Mecha
api-version: 1.18
authors: [ oliver193 ]
description: Mecha Plugin
website: https://github.com/oliver193/Mecha-Plugin
commands:
heal:
permission: mecha.heal
description: Heal yourself.
usage: /heal
feed:
permission: mecha.feed
description: Feed yourself.
usage: /feed```
plugin.yml
package me.oliver193.mecha;
import me.oliver193.mecha.commands.FeedCommand;
import me.oliver193.mecha.commands.HealCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Mecha extends JavaPlugin {
private static Mecha instance;
public void onLoad() {
instance = this;
}
public void onEnable() {
getLogger().info("Mecha is loading.");
// Load commands
getCommand("heal").setExecutor(new HealCommand());
getCommand("feed").setExecutor(new FeedCommand());
}
public void onDisable() {
getLogger().info("Mecha is disabling.");
}
public static Mecha getInstance() {
return instance;
}
}
yeah that looks fine
how do you check to see if a item has a PDC?
Any or a specific one?
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Any, just need to check if the item has something inside it
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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
xD
man you illiterate as fuck
just ask the question and someone will help you
are you a troll this has to be a troll
I give up
stop spamming
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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
👀
?ban @quaint mantle trolling
Can you read yet?
Done. That felt good.
don't waste your time and just block them
I made a hashmap to track player's heat value, how can I retrieve the int using the UUID ?? cpp @EventHandler public void onJoin(PlayerJoinEvent event2) { heatMap.put(event2.getPlayer().getUniqueId(), 0); } }
heatMap.get(uuid);
heatMap.get(someUUID)
public boolean hasAnyData(ItemStack itemStack) {
if(itemStack == null || !itemStack.hasItemMeta()) {
return false;
}
return !itemStack.getItemMeta().getPersistentDataContainer().getKeys().isEmpty();
}
Not really useful but here you go
its sad sometimes I can't tell if people are trolling or just stupid
yeah sometimes people are just plain stupid and you think they are trolling but actually they aren't lol
hmm
what's wrong with that?
dont even need to add the extra stuff it does it for me already ;p
yes, that's what plugin.yml is for
ok i'll go remove that extra shit i added
which isnt needed
alex do you want the very first build i made of it
to see how bad it is
this is equation from explosion
and how do I increment it?
get the value, +1 it, set the value back to the map
Valhalla when
.replace() ?
?
no, set with put
aight
public static <T> void increment(Map<T,Integer> map, T object) {
map.put(object, map.getOrDefault(object, 0) + 1);
}
bootleg compute
if someone wants to be spoonfed, they get it
it's their own fault that they won't understand anything then
public static <T> void increment(Map<T,Integer> map, T object) {
map.compute(object, (key, value) -> value == null ? 1 : value + 1);
}
Or:
map.merge(key, 1, (old, ignore) -> ++old);
perfect, there's no way they'll understand this lol
@carmine valley use this
but wait
if value is null it should be 0 not 1
Nah, use Map#merge, no Map#compute
why not this int heatValue = heatMap.get(event.getEntity().getUniqueId()); heatValue++; heatMap.put(event.getEntity().getUniqueId(), heatValue);
0 incremented by one. So 1
Autoboxing
yes that works
Project Valhalla is not a thing yet
Unless you come from the future
In that case I am relieved that it is a thing
wtf is this valhalla thing you keep mentioning all the time
Universal generics
I also really like using MutableInt for this
public static <T> void increment(Map<T, MutableInt> map, T object) {
map.getOrDefault(object, new MutableInt(0)).increment();
}
And LWorld
I really have no idea what you're talking about lol
Then you don't care about performance all that much heh
I actually don't
I suspect it will also take qute a bit more refining until its an adopted JEP
I only care about performacne when it's worth it
I mean if you have very hot code then you can use FastUtils
Well avoiding boxing will have a massive performance impact
avoiding chunk loading will have a massive performance impact
avoiding unboxing has a totally neglegible performance impact
Hey, does anyone here have experience with pufferfish? https://github.com/pufferfish-gg/Pufferfish Do normal spigot plugins work with it or is there an api for it somewhere?
It tends to be worse than one thinks
There are applications where every bit is crucial. Ask goldman sachs for example. They write their own primitive collection framework.
But really Valhalla also ships nice QoL changes such as Records
Ah, that was Amber
They do have primitive classes as JEP 401/402, which has more or less the same spirit
for some reason my plugin runs the onDisable method whenever I do /stop but if I do /restart it doesn't. Anybody know how this is possible>
i did a fly command ;D
package me.oliver193.mecha.commands;
import me.oliver193.mecha.Msg;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class FlyCommand implements CommandExecutor {
private ArrayList<Player> list_of_flying_players = new ArrayList<>();
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.");
return true;
}
Player player = (Player) commandSender;
// Enable/disable fly mode
if (list_of_flying_players.contains(player)){
list_of_flying_players.remove(player);
player.setAllowFlight(false);
Msg.send(player, "&cFlight has been disabled.");
}else if(!list_of_flying_players.contains(player)) {
list_of_flying_players.add(player);
player.setAllowFlight(true);
Msg.send(player, "&aFlight has been enabled.");
}
return true;
}
}
Nice! 😄
gonna test it
I feel like you have done most if not all of the errors I would point out right now on purpose
what errors do you see?
i want to say soo much about whats wrong
same lol
There is easier/better ways to do it but I think that works for someone who doesn't know much java
- Using ArrayList instead of List (You declare using the interface most of the time)
list_of_flying_playersbeing in snakeCase- Using ArrayList instead of HashSet (Set is better at #contains)
- The alias parameter is mislabled
- The args parameter is mislabled
- Having a class called
Msg(Class names should be descriptive) - .contains and .remove can be in one call
- No need to call .contains twice - if X does not contain Y, we know that X does not contain Y and do not need to test that again
- Not checking whether another plugin has disabled flight in the meantime
- Using
<Player>instead of<UUID>(Avoid memory leaks) @Overrideis blatantly misplaced- No space between
)and{, while sometimes it exist (Keep code consistent) - Relatively useless comments (Code should be self-documenting)
list_of_flying_playersshould be finallist_of_flying_playerstoo descriptive. The fact that it is a list is already shown through the datatype
So yeah, there is a bit too much wrong there
If I use Raid.getLocation() do I get the center of the village?
or a different location in the village
would this be better in this case @quiet ice
when i put UUID it comes up with java.util
Yeah, that is the right one
ah didn't see the Arraylist
though really you'd have private final Set<UUID> flyingPlayers = new HashSet<>();
it imported that
that is the correct import
a UUID isn’t a Minecraft thing lol
It’s a global standard for unique id’s of any resource
anyone knows?
?jd-s
get it from the player object?
if (flying.remove(player.getUniqueId())) {
player.setAllowFlight(false)
}```etc
have you gotten that far into spigot without knowing how to get a unique id? Not trying to be rude or anything just honestly wondering
HashSet#remove will return true if it was actually able to remove the element
also HashSet#add will return the same, but for adding
how can i get item's attack speed and damage from it attribute modifiers?
ok all the errors are gone now just these which i can ignore i guess
Well at least your IDE is set to be pedantric
I mean you can just implement the fixes to them and have no warnings lol
my 4gb ram begging for mercy
show what's exactly in that spot
no
is it just a list like
list:
- "player blalblala
```"
what does "instance" do?
okay, gonna test this now
package me.oliver193.mecha.commands;
import me.oliver193.mecha.Msg;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class FlyCommand implements CommandExecutor {
private final Set<UUID> flyingPlayers = new HashSet<>();
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
Msg.send(commandSender, "&cThis command can only be used by players.");
return true;
}
Player player = (Player) commandSender;
// Enable/disable fly mode
if (flyingPlayers.contains(player.getUniqueId())){
flyingPlayers.remove(player.getUniqueId());
player.setAllowFlight(false);
Msg.send(player, "&cFlight has been disabled.");
}else if(!flyingPlayers.contains(player.getUniqueId())) {
flyingPlayers.add(player.getUniqueId());
player.setAllowFlight(true);
Msg.send(player, "&aFlight has been enabled.");
}
return true;
}
}
need the spacing
shoot
How can i make this to be created when the server starts? I have tried save resource but i don't know how to use it.
@quiet ice @tardy delta your method worked
if (flying.add(player.getId())) {} else {} is something
Guys I need to store Data from MySQL to an HashMap.
Basically on the database I have UUID and Playernames related to UUIDs
I am selecting the Columns from the table
"SELECT UUID,NICKNAMES FROM databasename ";
So now I have UUID and Nicknames in the ResultSet.
How can I iterate through it to put in the HashMap<UUID,String> the values?
while (resultSet.next)
resultset.getString(Uuid)
And resultSet.getString(nickname)
And put it in the map
^^
Let me see your pom
Maven filtering corrupts schematics
uhm
I am new about mysql, I just know the basic, but with this function I will load correctly all the UUID and Playernames related in the HashMap?
sure wait a sec
I mean, UUIDs corresponding to pplayernames correctly
resultSet.next tells u if there are more rows in the resultset and moves to the next one if there is
So everytine you get data from a resultset, it corresponds to a row so yes
a thing might be to check if the player is not in creative before disabling its flight, cuz it overrides it
yeah maybe i'll do it later
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>schem</nonFilteredFileExtension>
<nonFilteredFileExtension>tar.gz</nonFilteredFileExtension>
<nonFilteredFileExtension>tgz</nonFilteredFileExtension>
<nonFilteredFileExtension>gzip</nonFilteredFileExtension>
<nonFilteredFileExtension>schematic</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
Make sure you have the schematic extension as non filtered
ye
thank you minion
Hey, does anyone here have experience with pufferfish? https://github.com/pufferfish-gg/Pufferfish Do normal spigot plugins work with it or is there an api for it somewhere?
what is this teleport api i keep hearing about?
Complete compatibility with any plugin compatible with Paper
papers async teleport
return inventory.getItem(inventory.first(type));
}``` what is wrong with this code?
Hey Minion, Because I store UUID using UUID Binary16, how can I get them in the resultset?
I have binned to them so SELECT BIN_TO_UUID(UUID) etc, but How can I get them?
at java.util.Arrays$ArrayList.get(Arrays.java:4165) ~[?:?]
at net.minecraft.core.NonNullList.get(NonNullList.java:47) ~[paper-1.18.1.jar:git-Paper-186]
at net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity.getItem(RandomizableContainerBlockEntity.java:111) ~[?:?]
at org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventory.getItem(CraftInventory.java:49) ~[paper-1.18.1.jar:git-Paper-186]
at me.placek.blockeconomy.tools.InventoryManager.getItem(InventoryManager.java:32) ~[BlockEconomy.jar:?]
at me.placek.blockeconomy.tools.InventoryManager.removeItems(InventoryManager.java:21) ~[BlockEconomy.jar:?]
at me.placek.blockeconomy.commands.test.onCommand(test.java:18) ~[BlockEconomy.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
... 21 more```
inventory.first returning -1
but why?
but there is
for(ItemStack item : inventory.getContents()) {
if(item != null) {
if(item.getType().equals(type))
return item;
}
}
return null;
}``` it's better for me
Run the query in a sql client like heidisql and see what the column name is
U could just use uuid as a string
And do UUID.fromString()
To get back your uuid
No problem because I am using Binary 16 UUID? and calling it using a String method?
Idk what binary16 uuid is sry
SELECT BIN_TO_UUID(uuid, true) AS uuid, nickname FROM foo;
Yes that's what I am doing, thanks minion
In command executor what is the parameter label for?
like if I use /idk label would be "idk"?
ok thx
I have this piece of code which creates an explosion. Is there a way to increase the power of the explosion so it could destroy anything?(max obsidian)
yeah my bad forgot about that 🤦♂️ . Can you change the power of tnt though?
If I have "RED" in a string how do I use it like ChatColor.RED?
ChatColor.valueOf(String)
ok
hey there, I have a question which I am a bit dumbfounded about. I have never had problems with Spigot Events and maybe it is completely obvious, but I am registering a listener class, and in the class i have two eventhandlers. The blockbreakevent handler works and gets called, the blockplaceevent however does not. Does anyone know why?
the event handler https://paste.md-5.net/giboxiqoki.java and in the main plugin file https://paste.md-5.net/ivemedibiv.java
i removed a few parts but that's basically it
Someone Can Help? Its doesnt working properly. Its just returning /setwarp
https://paste.md-5.net/asiyitucas.java
so the "place" never gets called?
Test this
It should work
that's what i am thinking too haha
If you handle the usage, return true
If you return false, bukkit sends the usage to the player
I set all return to true but its same
What do u see in ur chat
Runnables
just /setwarp
public CommandSetWarp(WarpMain plugin){
this.plugin = plugin;
plugin.getCommand("setwarp").setExecutor(this);
}```
Is this a thing?
First time seeing someone register the command directly in the same class
U can do that
yep
Did you do new CommandSetWarp in your onEnable?
yeah I tried but same
Paste ur main pls
whats ur plugin.yml looking like?
re-open the inventory or what?
?paste
nah
U can abstract it away tbh if you wirte a good menu library
Arda u sure u do new CommandSetWarp in ur main
^
I tried it before but it was same
Caused by: java.lang.NullPointerException: Cannot invoke "com.sk89q.worldedit.schematic.SchematicFormat.load(java.io.File)" because the return value of "com.sk89q.worldedit.schematic.MCEditSchematicFormat.getFormat(java.io.File)" is null
Why is this null?
WorldEditPlugin worldEditPlugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
File schematic = new File(SkyblockPlugin.getInstance().getDataFolder() + "schematics/island.schematic");
EditSession session = worldEditPlugin.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(SkyblockPlugin.getInstance().getSkyblockWorld()),
10000);
try {
CuboidClipboard clipboard = MCEditSchematicFormat.getFormat(schematic).load(schematic);
clipboard.paste(session, new Vector(loc.getX(), loc.getY(), loc.getZ()), false);
} catch (MaxChangedBlocksException | DataException | IOException e) {
e.printStackTrace();
}```
Try it again
Paste your main before u test
Doesn't recognize the format of the schematic
does it end with .schem or .schematic?
schematic
what version are you using ur plugin on?
1.8
i'll try
same error
I'm getting java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins/main-1.0.jar and idk why.
I have this in my main file ``` this.saveDefaultConfig();
config.addDefault("playerMutedColor", "RED");
config.addDefault("playerMutedText", "The chat is currently muted!");
config.addDefault("chatMutedColor", "RED");
config.addDefault("chatMutedText", "The chat has been muted!");
config.addDefault("chatUnmutedColor", "GREEN");
config.addDefault("chatUnmutedText", "The chat has been unmuted!");```
event for when player crafts item in crafting table?
Show ur ide folder paths
CraftItemEvent
if (!schematic.exists()) {
System.out.println("Schematic doesn't exist");
return;
}
I did this
how do I get player from it (1.8)
but still the same error
config has to be in resources
event.getPlayer()
ok
no such method exists, that's why I'm asking
Ah ok so it exists
yes
Did u do what intold u with the resource filtering?
File schematic = new File(SkyblockPlugin.getInstance().getDataFolder(), "schematics/island.schematic");
this?
oh
that thing
but the schematic does exists
it doesn't get filtered right?
@humble tulip same thing that caused me trouble you mean?
@iron glade thank you! it works
ur welcome
how do I get player from CraftItemEvent and how do I change it's result
No filtering is maven setting placeholders
you have to create it
Make sure schematic files are ignored
hmm
Yh maybe
@limber owl it's getWhoClicked()
<nonFilteredFileExtension>schem</nonFilteredFileExtension>
<nonFilteredFileExtension>tar.gz</nonFilteredFileExtension>
<nonFilteredFileExtension>tgz</nonFilteredFileExtension>
<nonFilteredFileExtension>gzip</nonFilteredFileExtension>
<nonFilteredFileExtension>schematic</nonFilteredFileExtension>
</nonFilteredFileExtensions>```
you seriously said that I have to change spigot code?
I think the schem and schematic one is enough but as it started to work for me I didn't want to touch it anymore
@acoustic pendant
paste it right?
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>schem</nonFilteredFileExtension>
<nonFilteredFileExtension>tar.gz</nonFilteredFileExtension>
<nonFilteredFileExtension>tgz</nonFilteredFileExtension>
<nonFilteredFileExtension>gzip</nonFilteredFileExtension>
<nonFilteredFileExtension>schematic</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>```
that's where I have it
and it stopped all my trouble with schematics getting corrupted
Hello there dear friends, does any spigot plugin works like vault on 1.18.2 version?
vault is still working for me
can u send me
it's the official one from the site
1.18.2 vault
Cannot resolve symbol 'nonFilteredFileExtension'
?paste show me your pom
@limber owl
Maven resources plugin
did you use it?
ah yes indeed
yea
Yeah Its same. I tried everything
has to be in the resources one
sometimes it shows red but there are no problems, did you reload maven?
yes
Is there a way to make auto completions in a config.yml?
Send both ur main and plugin class
?paste
Wrong plugin as we told u
It's the maven resources plugin
Delete all thebred stuff
still in the compiler plugin
Paste this under plugins
U can remove all the useless extensions
how do I make notes in a config.yml file?
k
well, the schematic "created" but i have other error xD i'll try to figure it out thanks
those are called comments
if(type == Material.WOOD_AXE || type == Material.STONE_AXE || type == Material.IRON_AXE || type == Material.GOLD_AXE || type == Material.DIAMOND_AXE)
``` any way to improve this if statement?
Another error?
yea, it's related with the paste#
Can we see
well, if you want
Check if material ends on "AXE"
Are you using fawe?
fawe?
fast async world edit
don't think so
did you paste more than 10000 blocks?
use an EnumSet and use #contains
Don't
thanks
API may change. It might not be an Enum in the future
smh when it changes edit it
In which case you just change it to a HashSet
That'll break so many stuff
This is noted in the 1.18 release post
It won't matter
guys handsdown which api are you using atm?
Please tell me how to do something similar. Maybe someone has a guide or know?
API as in what?
bukkit / spigot / paper
As long as the variable type is just Set<Material> like it’s supposed to be and is just initialized with an EnumSet, you can easily swap that out when you need to update
Custom spigot
Lol
if youre checking Enum#name and it isnt an enum anymore if will break too
custom resource pack I guess
Resource pack
and i guess when material changes to a class, there are still a kind of constants?
Bukkit is dead, so mostly spigot. When I need to use adventure and I am developing for my private server I use paper
Yeah, but how?
Which item should i use?
Not item
And what texture should it have?
You have textures for the inventory
No?
That's a player head
No, i want, that this texture have only one inventory
i would probably just make it it an oversized item texture
as you dont want to overwrite the inventory
That's possible?
Today I'll show you how to add new GUIs (graphical user interface) to Minecraft! You don't have to replace any pre-existing GUI textures and you can make anything you like, new containers, new storage blocks, new crafting station, whatever you want!
►Subscribe - http://bit.ly/Subscribe_Sarc
►Follow Me On Twitter - http://bit.ly/SarcTweet
─────...
yea
Today I'll show you how to add new GUIs (graphical user interface) to Minecraft! You don't have to replace any pre-existing GUI textures and you can make anything you like, new containers, new storage blocks, new crafting station, whatever you want!
►Subscribe - http://bit.ly/Subscribe_Sarc
►Follow Me On Twitter - http://bit.ly/SarcTweet
─────...
Oh we found the same video
Lol
You are the best
I tested it and I realise this is a bit offtopic, but I was running it on a mohist server and there it is not working. On vanilla spigot everything works great.
On the offchance that anyone here knows of any possible reasons, I would appreciate any help :)
this is a quote from the paper docs "Any hybrids that attempt to support both mods and plugins are fundamentally flawed and not recommended for use."
There’s also this one @crude cobalt https://youtu.be/SbdLNsWn7aI
Today I'll show you a brand new, custom Mana Bar in Minecraft! This trick allows you to display pretty much anything you like on the screen as a custom HUD!
►Subscribe - http://bit.ly/Subscribe_Sarc
►Follow Me On Twitter - http://bit.ly/SarcTweet
───────
Other info:
───────
Music: http://incompetech.com
Sound Effects: http://www.freesfx.co.uk...
Probably dumb question but any idea how to determine spawn placements for uhcrun?
whats uhcrun
welp i guess thats true 😔 thanks anyways though
Wat is mohist
some weird mod / plugin server hybrid
yes its a forge plugin hybrid server
Uhc? You never heard of it?
yea but what is uhc run
Faster version
Like enchants for shovel, axe, pickaxe, and it autosmelts your resources when you mine them
so you want spawn placements for player, items or what
When I make a plugin it's name has the version in it's end and I don't want it. I tried to remove it but id makes an error.
Is there a way to make the version null or something like that?