#help-development
1 messages · Page 384 of 1
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.
Show me an example code
And your getIP return nothing. Nice.
3 commands for the learnjava thing now, nice
Is basics a less passive aggressive version of learnjava?
yes
lul
Lmao
we had basics for a while
learnjava! is pretty aggressive
AllArgsConstructor takes all fields as parameters
*Which are not pre-initialized ofc
In which way?
= null?
@RequiredArgsConstructor only uses those fields which need to be initialized in order to construct the class.
i might aswell start to use lombok
Probably not
interesting If a sheep is within a certain distance of another sheep, it will move towards it and try to stay close to it. This distance is controlled by the "follow range" attribute, which is set to 8 blocks by default.
Hey guys. Is there an easy fix for when two plugins use the same command? How do you choose which takes priority- or even change the commands? The two plugins are EpicCore and Lands-land claim plugin with the same command /chat.
Possible to create object that implement interface on the runtime?
Any interface extend parent interface
I decided to make a server where gamemode adventure will be by default, but all the plugins that I found do not help...( and there is also an auth me plugin on the server and it resets it to 0. what should I do in this case and which plugin /datapack is needed for the automatic issuance of gm 2 when entering the server? (pls ping me)
new Interface() {
void someMethod() { return true }
};
damn chatgpt is lying so badly
Sure. Those are called anonymous classes
I want to inject implementation to the interface on the runtime
Either use the fully qualified name /epiccore:chat or ask the devs to create alias for their commands.
Bruh I think it was impossible.
Explain a bit more what you are trying to do.
Java is very moldable.
you want to inject method behaviour?
Doesnt the server.properties define a default gamemode? Have you tried that?
just already create an object that implements your interface and have functions (like Runnable) for each method impl
thats the most simple way, but idk what you want to achieve
yeah
thank you bunches u gave me an idea for a fix
and how will I build?
I have interface that has ??? methods with @sql(query="sql") annotation. So I need to inject implementation that executes sql query when method called.
What do you mean by inject? Should another plugin provide an implementation for this interface?
arent you just trying to get the value of the query annotation?
Yea it hard to explain 😩
just give an example
Ok
Nope i think hew wants to write a text query and let the interface execute the query.
But there is no actual implementation for that interface. He basically wants to "inject"
an implementation so that the query is actually run by usefull code. Im still trying to find
out when and from where he actually tries to "inject" the implementation so that i can recommend
either using RegisteredServiceProvider or a Factory pattern.
oh i kinda understand
You can't
in c# you can :)
Sql have order of keywords
well how is it supposed to know what logic it executes 🤔
sounds like abusing someone elses code
Either a factory which provides an implementation or a RegisteredServiceProvider (vault uses this)
But someone has to write the implementation
public interface SQLController<object> {
@Query(query = "SELECT * FROM %name% LIMIT 1;", response = RepoResponse.EQUAL_ONE)
object findFirst();
@Query(query = "SELECT * FROM %name% LIMIT 20;", response = RepoResponse.MORE_THAN_ONE)
List<object> findTwenty();
@Query(query = "INSERT INTO %name% VALUES(hello = %hello%, wassup = %wassup%;", response = RepoResponse.VOID)
void insert();
}
Something like this.
just have common code for all those methods that executes those queries ig
then figure out whatever type of query it is aaa
im just wondering why
I mean it doesnt make much sense for this to be in an interface in any case
writing a query is an implementation
there are probably some restrictions
I see what you mean here. This is a concept from enterprise java. If you want to i can give a rough explanation on how
to implement this but it is very complicated.
looks like spring
Yea please explain how to implement.
Yes it looks like JPA annotations
So how?
Or I can just use JPA?
Do you know all of these concepts:
- Classpath scanning
- Reflections
- ORMs
- Beans
bytecode injection 🙉
ik beans and Reflections
another idk
Honestly i would just recommend you to use Hibernate
It implements the JPA standard
Looks a bit like this:
@Entity
@Table(name="STUDENT")
public class Student {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(name="STUDENT_NAME", length=50, nullable=false, unique=false)
private String name;
// other fields, getters and setters
}
And then you can just throw your objects in a database as they are.
Cool so I not need to implement my self 🙂
And then you can also use your @Query annotation for some custom DAOs
i tried to make something like that but reflections but it went brr
too much annotations, reflections and stringbuilders
how can I find out if an object isnt getting deleted
because I am making a game but everytime I start it the old instance doesnt get removed
like im used to c++ and stuff where I have to free thngs myself so idk how it works here
finalize kinda goes brr
This happens if you dont write robust code. Strongly encapsulate your objects and you will never have
problems with random references floating around.
It deprecated I guess.
well
for a reason
How can people code using Velocity, they api is relly unfriendly
to invoke code when an objects is getting gced now, look at the cleaner api
2nd time saying that
Really?
and you sure arent on weed?
like how does a reference get lost anyways
Show us your code. Object deletion should not be something you have to keep in mind when writing java.
free() :(
there is too much to just show but I can try to give a summary
Like manually setting a reference to null is almost always a code smell.
There no free function for java bruh.
so for reference I am creating a minigame plugin for bingo, and I have a "gamemanager" called GameWorldManager, in it I have a list of active games and I can add games to that list and remove them when they are done
but when I remove them they dont seem to get deleted
but just talking about this made me get an idea on something I should still check xD
java is not a low level language for a reason
Well you have some api that allows u to callback garbage collection
Uhm... what?
oh no we summoned conclure
Not api bruh
runn
Runtime
Yes
PhantomReference and WeakReference with a ReferenceQueue is provided by Java std
Use a LinkedHashMap and sort it before joining.
(Also SoftReference)
Idk how you creating the manager for each player or it singleton object.
Ah -.- i thought the was some hacky replacement for finalize i didnt know
🥲
what
PS you can also wrap the entry set in a List<Entry<K, V>> and call Collections.sort on it with a custom comparator which sorts by value or key
okay nvm this is still the case
I believe that Java should provide low level api, but similar to rust, the user should be well aware of in case they enter that type of shit
foreign memory api begs to differ
Unsafe my beloved
those objects are listeners so when an event happens it fires for all of them, so they must still exist
Is it still in incubation btw?
You registered them with Bukkit so it's holding a reference
yes
this is kinda fun
is the best place to do that when I remove them from the list? cuz afaik there are no destructors in java
Sounds like a side effect to me
All you do is drop all references and GC will delete them
gc should be able to handle that
So glad i learned how to do bézier curves. They looks so smooth.
like I add my plugin as a variable to another class
you drop all reference the object you want to delete
:o
looks like santa spawning presents mid-air
yeah so dropping a reference is really just removing them from whatever container they might be in
or leaving the scope
So you did your manager Listener aswell?
So you can show your code?
why?
xD
I already know what I need to do to fix it
and its too much to just show here
Ok do it yourself :))
now i want to learn it 😦
i just want to know how to let chunk generation work on minestom
but this looks pretty good
Is there a function to get when a player has joined/for how long has been online?
(i cant find it)
Only this session or in total?
session
thats not possible right
oh
eehm actually, how do I unregister a listener?
you could always keep track of it
HandlerList.unregister(Listener) or smth
There is no info on that. You need to track that yourself.
PlayerJoinEvent -> get current time and put it in a Map<UUID, Instant>
oh
ok thanks
I like the consistency
Dont tell me that you have a listener for every active game...
well they are listeners
o.O
we love managers
Registering one listener which propagates the events to every game
Yes
I already have like 5 of those
I sure hope that you have a GameManager
yes thats what I was saying earlier
thats how I add and remove games
but that one isnt a listener
Alright let me give you a minimal example. One moment.
Ideally you want to avoid registering and unregistering listeners anywhere other than onEnable()
Every time you do that, the listeners have to be re-baked
Which isn't exactly cheap
okay
how i can get the player that killed an speficic mob?
is this explained anywhere?
Does it really have to be rebaked? Like I thought that was just to make the event invocation smoother?
(Which bukkit does once after all plugins have been loaded and enabled)
It is. It's baked for performance reasons. But the whole thing has to get rebaked if a new listener gets added
like how tf am I supposed to know when to or when to not register events xD
what does re baked mean in this context?
Tho, wouldn’t it still work fine w/o rebake after initial server load up?
Cause I know some libraries that lazily register listeners taking JavaPlugin::getProvidingPlugin and just passes it along with the listeners
public interface ActiveGame {
void handleDamageEvent(EntityDamageEvent event);
void handleDeathEvent(EntityDeathEvent event);
}
public class GameManager {
private final List<ActiveGame> activeGameList = new ArrayList<>();
public void handleDamageEvent(EntityDamageEvent event) {
activeGameList.forEach(game -> game.handleDamageEvent(event));
}
public void handleDeathEvent(EntityDeathEvent event) {
activeGameList.forEach(game -> game.handleDeathEvent(event));
}
}
public class GameListener implements Listener {
private final GameManager gameManager;
public GameListener(GameManager gameManager) {
this.gameManager = gameManager;
}
@EventHandler
public void onDamage(EntityDamageEvent event) {
gameManager.handleDamageEvent(event);
}
@EventHandler
public void onDeath(EntityDeathEvent event) {
gameManager.handleDeathEvent(event);
}
}
Then you will never have to unregister any listeners. All you do is remove a game from the list and it doesnt receive any events anymore.
Ugh the spam
Ah okay
well yeah I guess that makes sense
I just hoped there was a more straight forward way
but this is fine
thanks

HandlerLists after someone constantly un/registers events
lmao
id make the gamemanager implement Listener 🙏
do private methods work for a listener?
Separation of concerns fourteen
Yes but not recommended
I'd personally argue it's more recommended to make them private lol. I don't want my listeners being manually called
something something reflection fkery taking longer. I looked into that back in spigot 1.12
Was something about the JIT taking longer for method invocations to get JIT compiled on private methods
because of the accessible flag
Reflection invocation beinng reimplemented with method handles soon 😌
But i guess spigot now uses MethodHandles (?)
:o
okay so im learning gradle and i dont understand how to add a module to another module?
Never bothered benchmarking it in java 17 so my assumption stems from java 1.8 and spigot 1.12 data
gradle kek
like their dependency or whatever
Instead of depending on its groupId and artifactId, you depend on project(":YourModuleName")
So compileOnly project(':foo-bar') for example
love it how my pom.xml has errors and it still compiles
everytime i do that it gives me this?
wait so coming back to this code, why did you split up GameManager into a GameListener too?
I feel like those can just be one class
As i told fourteen: You want separation of concerns + single responsiblity
A listener has one specific purpose: Listen to events and propagate them to places where they are needed
They can, but they lay at different levels of abstraction also. GameManager being at a higher level than your listener.
me where my VanishManager is a Listener, Reloadable and Iterable<UUID> :)
what do you mean by that? how is the gamemanager higher?
separated the listener tho
What do your settings.gradle and build.gradle look like?
Your listener is a low level class, no other classes are going to depend on it, its just a consumer and observer, whilst your GameManager is a class that other classes are going to depend on, such as listeners, command executors and other stuff.
like to me it looks just as concrete as the listener
It may not seem very apparent, but in the long term, having high and low level components/classes figured out helps quite well with the structure (:
Yeah well if that’s an issue then it’s time to start considering the amount of files you have
Though with all due respect, that is likely not going to be a concern of yours
Sounds good :>
A project me and a buddy wrote in 6 weeks
"crypto" XD
imaging writing a book
Ah makes sense
I mean atleast there is no utils package with like 50 random classes
HEEHEEHEE
nvm
wait are these separate folders from the other ones?
there is double crypto
would be a nightmare to find anything I imagine lol
wdym separate folders
from these ones
or was that the same screenshot but cropped differently
cant be bothered t read everything
last screen is a subfolder of the first
always fun looking at internals and seeing that half of the stuff isnt used
id say getOpenInventory().getTopInv() == custom but from what i understood from Elgarl you cant
what objects
how would objects be joined lol
Stream#reduce 💀
I guess StringBuilder has append(Object) which just calls toString() on the appended Object
you can tell if a specific inventory (not Players) is open, but you can;t tell if the player has his own open
so how do I check if my custom inventory instance is open?
https://docs.papermc.io/paper/dev/custom-inventory-holder is always a possibility
or yea
yep
ew
oh
keep track of the instances ^
I went on a half assed journey with advancement triggers. Never figured out if it actually works.
well nvm then, thats just as bad as looping through the inventories itself xD
Isnt there a modern resource on how to create GUIs which use the chain of responsibility pattern? 🤨
Speaking about the general idea of Map<Integer, Consumer<InventoryClickEvent>> and variations
public void run() {
if(Bukkit.getOnlinePlayers().contains(e.getPlayer())){
if(e.getPlayer().getInventory().firstEmpty()!=-1){
e.getPlayer().getInventory().addItem(coin.coin());
}else{
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNie masz miejsca w ekwipunku!"));
}
}
}
}, 0L, 1200L * 1);``` I got this task, and it runs everytime when i join to server. I want to start this after specifed time and repeating this
i must change delay?
the first one is delay in ticks yes
okay, thanks
I would handle this differently.
Dont create one runnable per player.
Create a single runnable which iterates over all players and start this runnable when
the server starts.
and use a lambda instead of a runnable
And use a concrete class implementation instead of an anonymous one or a lambda.
and if you dont want to get bonked by me, never instantiate bukkitrunnables unless its needed
Would look like this:
public class CoinRunnable implements Runnable {
private final CoinSomething coin;
public CoinRunnable(CoinSomething coin) {
this.coin = coin;
}
@Override
public void run() {
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
giveCoinTo(onlinePlayer);
}
}
private void giveCoinTo(Player player) {
PlayerInventory inventory = player.getInventory();
if (inventory.firstEmpty() != -1) {
inventory.addItem(coin.coin());
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNie masz miejsca w ekwipunku!"));
}
}
}

i know you, you added the giveCoinTo to use this::giveCoinTo ;-;
XDD yes
but yet youre not doing it
But i didnt want to confuse him
Oh yeah: Your approach creates a memory leak.
yeah, i had it like this, but it was a little unfair, because players whom joined a few seconds before award gotted it
This is fixable. But if you use your approach then you need a Map<UUID, BukkitRunnable> and cancel the runnable every time a player quits.
You need to also remove the player from the map ofc.
Weak map
Okay, thanks for advices, I'll try to do it
How to check if a player has an inv opened?
Any inventory or a custom one?
custom
scroll a few minutes back ^^ oh
Put your custom inventories in a Set<Inventory> and check for contains() on it
*Remove them on inventory close
Something that was mentioned above as well: Custom InventoryHolders
the PlayerInteractEvent wont be triggered if i right click the air with a item (even a bow or anything), its always being cancelled before it runs. Anyone know what could causing it? If i right click a block its working without any problems
I am confused but I will try
How do you determine if the event got fired or not?
Did you register the listener?
Yes, i send a broadcastmessage if its triggered and if i right click a block message getting send, right clicking the air it won't get send
Put something in both hands and tell me if you see a difference
nothing changed
Then show some code
How do you get a method from a class you’ve extended from to return the object representing your current class?
Rn thats the code, cuz i just wanna check if its even triggered @EventHandler(ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
Bukkit.broadcastMessage("PlayerInteractEvent triggered!");
}
how do I make an Item Unstackable?
I got this code but how do i cast it to ItemStack
public void setMaxStackSize(Item item, int i){ try { Field field = Item.class.getDeclaredField("maxStackSize"); field.setAccessible(true); field.setInt(item, i); } catch (Exception e) { e.printStackTrace(); } }
@EventHandler(ignoreCancelled = true) remove this and double check if you registered the listener.
Like if you have the class dirt which extends the earth, and earth has a method ‘returnSelf’ which just returns itself, how do I get that method to instead return the dirt object instead of the earth object?
object representing your current class
Are you looking for a method which returns a Class<> object?
you mean ignoreCancelled or the whole thing?
Only ignoreCancelled
@lost matrix I think so
Well they are both exactly the same object
now message is send
Well then the event was cancelled before it reached your listener and you opted to ignore cancelled events 🤷
Not really, the issue is when it returns, it returns as the ‘Earth’ class and NOT the ‘Dirt’ class, so I can no longer call methods unique to the dirt class.
Just add a random PDC tag to your ItemStack.
yes but i dont know why it is getting cancelled, its the only code and the only plugin
If I go Dirt.returnSelf()
wdym
That returns an earth object
Then check with instanceof and cast your object...
Earth earth = someMethod();
if(earth instanceof Dirt) {
Dirt dirt = (Dirt) earth;
dirt.dirtOnlyMethod();
}
Or in newer java versions:
Earth earth = someMethod();
if(earth instanceof Dirt dirt) {
dirt.dirtOnlyMethod();
}
And returnSelf is a useless method. Remove it.
?pdc
@lost matrix is there some way to make this generalizable so I don’t need to check with instanceof all the subclasses of Earth, though?
well if they all have different methods, you need to call them one way or another
How are you going to generalize this if every subclass has its own special methods??
So
In reality all these subclasses just have a method called ‘run’ which they derive from a class they implement called ‘LocationGenerator’, which just does a bunch of geometry to give me a bunch of locations in particular geometric distributions. It’s not actually dirt or earth etc
The bigger problem is I’d really like to be able to set the parameters for these subclasses independently of each other, and for that to happen I need methods which return the object which I can then call those same methods with again
But those methods are in the class which I am extending for these subclasses
Really
is there some way to make this generalizable so I don’t need to check with instanceof all the subclasses?
I mean I can
It’s not a huge amount
public static void main(String[] args) {
List<Animal> animals = new ArrayList<>();
animals.add(new Cat());
animals.add(new Dog());
animals.add(new Cow());
for (Animal animal : animals) {
animal.makeSound();
}
}
public static abstract class Animal {
public abstract void makeSound();
}
public static class Cat extends Animal {
@Override
public void makeSound() {
System.out.println("Miau!");
}
}
public static class Dog extends Animal {
@Override
public void makeSound() {
System.out.println("Wuff!");
}
}
public static class Cow extends Animal {
@Override
public void makeSound() {
System.out.println("Mooo");
}
}
Console output:
Miau!
Wuff!
Mooo
Take a close look at this pls.
Thats how germans write it out
germans wilding
Does not help
Ok let me take a closer look at your question then
Give me a bit I’ll paste code
what is lifesteal?
public class LocationGeneratorMeta {
public Location origin = null;
public Integer locationNumber = 1;
public boolean seekGround = true;
public boolean noSolids = true;
public List<Location> endLocationList = new ArrayList<>();
public List<Location> getLocationlist() {
return endLocationList;
}
public LocationGeneratorMeta setLocation(Location loc) {
origin = loc;
return this;
}
public LocationGeneratorMeta setPoints(Integer pnts) {
locationNumber = pnts;
return this;
}
public LocationGeneratorMeta setSeekGround(Boolean seek) {
seekGround = seek;
return this;
}
public LocationGeneratorMeta setNoSolids(Boolean slds) {
noSolids = slds;
return this;
}
}
public class LocationGeneratorCircular extends LocationGeneratorMeta {
public double outerRadius = 10;
public double innerRadius = 0;
public LocationGeneratorCircular setInnerRadius(double oInnerRadius) {
innerRadius = oInnerRadius;
return this;
}
public LocationGeneratorCircular setOuterRadius(double oOuterRadius) {
outerRadius = oOuterRadius;
return this;
}
}
public interface LocationGenerator {
public List<Location> run ();
public List<Location> getLocationlist();
}
not just germans
public class GenDisc extends LocationGeneratorCircular implements LocationGenerator {
@Override
public List<Location> run() {
//buttload of code to return a disc of random points based on the parameters in LocationGeneratorCircular and LocationGeneratorMeta
}
}
Alright makes sense so far
I want to be able to go:
GenDisc sampleDisc = new GenDisc();
sampleDisc.setNoSolids(true).setInnerRadius(5);
the issue with that is
setNoSolids returns a LocationGeneratorMeta, which does NOT have the setInnerRadius method
ah so you're trying to do a builder
in contrast, I could go:
sampleDisc.setInnerRadius(5).setNoSolids(true);
i guess so
i dunno what that is though lol
you need some sort of overarching class
Ok i understand you. This is a common problem for the Builder pattern. One moment ill fix it for you.
danke
Also not relevant but why are you doing some primitive and some not?
because i'm a complete idiot, primarily
yeah i should do that
not really a big issue but if you're using this hundreds of times over it can help a little
i do only use it once, but still, best practices
Just note, GenDisc is just one of MANY classes which all extend LocationGeneratorCircular and implement LocationGenerator
well
by many I mean like 4 lol
i guess in theory it might increase as I add more shapes
which is why im even doing this
Honestly now that i look at it: You are mixing a metric ton of different concepts into one class.
Why does your Generator extend its own meta? Shouldnt the generator have a field with its meta?
you mean why does GenDisc extend it? Or why does LocationGeneratorCircular extend it?
Both make little sense
i feel like all of it could be consolidated into a singular class
Well for the Circular i can understand it.
rather than having 2 separate classes
Alright let me scrap the GenDisc part and write something type safe for your meta.
There is also a LocationGeneratorSegment which extends LocationGeneratorCircular and is only used for cones and pieces of discs; it requires, in addition to the variables listed above, a vector for direction in space to point the segment and an angle which the segment takes up.
GenDisc extends it because there is also a GenSphere
Here is the solution:
public class LocationGeneratorMeta<SELF extends LocationGeneratorMeta<?>> {
private final Class<SELF> runTimeType;
public Location origin = null;
public Integer locationNumber = 1;
public boolean seekGround = true;
public boolean noSolids = true;
public List<Location> endLocationList = new ArrayList<>();
public LocationGeneratorMeta(Class<SELF> runTimeType) {
this.runTimeType = runTimeType;
}
public List<Location> getLocationlist() {
return endLocationList;
}
public SELF setLocation(Location loc) {
origin = loc;
return runTimeType.cast(this);
}
public SELF setPoints(Integer pnts) {
locationNumber = pnts;
return runTimeType.cast(this);
}
public SELF setSeekGround(Boolean seek) {
seekGround = seek;
return runTimeType.cast(this);
}
public SELF setNoSolids(Boolean slds) {
noSolids = slds;
return runTimeType.cast(this);
}
}
public class LocationGeneratorCircular extends LocationGeneratorMeta<LocationGeneratorCircular> {
public double outerRadius = 10;
public double innerRadius = 0;
public LocationGeneratorCircular() {
super(LocationGeneratorCircular.class);
}
public LocationGeneratorCircular setInnerRadius(double oInnerRadius) {
innerRadius = oInnerRadius;
return this;
}
public LocationGeneratorCircular setOuterRadius(double oOuterRadius) {
outerRadius = oOuterRadius;
return this;
}
}
public LocationGeneratorCircular() {
super(LocationGeneratorCircular.class);
}
Hm?
Ok but they should not extend their meta.
This is the cleaner solution:
public class GenDisc implements LocationGenerator {
private final LocationGeneratorCircular meta;
public GenDisc(LocationGeneratorCircular meta) {
this.meta = meta;
}
@Override
public List<Location> run() {
// use meta instead of "this"
}
}
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
md_5#0001
This bot is an instance of Red, an open source Discord bot created by Twentysix and improved by many.
Red is backed by a passionate community who contributes and creates content for everyone to enjoy. Join us today and help us improve!
(c) Cog Creators
@bold vessel
Thx
i spawned an arrow
and i couldn't pick it up
and there is no functions in Arrow interface in order to that
what should i do?
ok, i know, but bedwars must be developed in 1.8, and there is no other way to this, because its lightweight and anticheats are stablizied with that + pvp, im using paper 1.8
@lost matrix why cant they extend their meta?
public abstract class LocationGenerator<E extends LocationGeneratorMeta> {
public abstract List<Location> run(E meta);
public abstract List<Location> getLocationlist();
}
public class LocationGeneratorMeta {
public boolean noSolids = true;
public LocationGeneratorMeta setNoSolids(boolean slds) {
this.noSolids = slds;
return this;
}
}
public class CircularMeta extends LocationGeneratorMeta{
public double outerRadius = 10;
public double innerRadius = 0;
public CircularMeta setInnerRadius(double oInnerRadius) {
innerRadius = oInnerRadius;
return this;
}
public CircularMeta setOuterRadius(double oOuterRadius) {
outerRadius = oOuterRadius;
return this;
}
}
public class CircularGenerator extends LocationGenerator<CircularMeta>{
@Override
public List<Location> run(CircularMeta meta) {
return null;
}
@Override
public List<Location> getLocationlist() {
return null;
}
}
@restive mango how about something like this where generator takes an instance of meta which has to be of specific type
rather than having it extend a meta
Its a very dirty design. Its like a Wheelbarrow extending Dirt. It makes no sense.
it's not a method of BlockDAta
what should i use ?
have to get TileState iirc
it's because BlockData does not implement PersistentDataHolder
This sadly doesnt solve the abstract builder pattern problem.
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
package fr.program;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import java.util.Arrays;
public class ConstructorCommands extends Command {
private final CommandExecutor executor;
public ConstructorCommands(String name, String description, CommandExecutor executor, String... aliases) {
super(name, description, "", Arrays.asList(aliases));
this.executor = executor;
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
return executor.onCommand(sender, this, commandLabel, args);
}
}
``` How can I set up a permission in my constructor for cmds?
Permissions are defined in the plugin.yml
Alternatively you can check if the CommandSender has a certain permission in your execute method.
just call "this.setPermission(...)" in the constructor
Oh hes extending the bukkit Command...
There is a permission class?
there is
java annoying
but setPermission takes a string
declaration: package: org.bukkit.command, class: Command
Ah ok, so the name of the permission?
yes
np
public void d(EntityHuman entityhuman) {
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
ItemStack itemstack = new ItemStack(Items.ARROW);
if (this.fromPlayer == 1 && entityhuman.inventory.canHold(itemstack) > 0) {
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
PlayerPickupItemEvent event = new PlayerPickupItemEvent((Player)entityhuman.getBukkitEntity(), new CraftItem(this.world.getServer(), this, item), 0);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
}
[... more]
nvm, found it, "this.fromPlayer"
declaration: package: org.bukkit.entity, interface: AbstractArrow
setPickupStatus()
thats 1.19.3, i said 1.8
?1.8
Too old! (Click the link to get the exact time)
i already know about hat, but thanks
and i already mentioned the reason
?whereami
Hey @lost matrix can i send u part of my code in DM, i have one question and you are like a boss? If u have a second ofc.
Use ancient software -> Live with the consequences
You probably need to find out what NBT tags the Arrow has in 1.8
and then change them using NMS or Reflections.
You can send it here if you want. There are a lot of "bosses" around.
nbttagcompound.setByte("pickup", (byte)this.fromPlayer);
thank you, it did the trick
@lost matrix not sure this'll work tbh
because locationgeneratorcircular wouldn't return locationgeneratorsegment when its methods are called IF it is a segment
thanks for trying though
Mini Messages API ^.^
yes but that requires <gray> or <gradient:red:green>
which most people dont know
im using it for a config
so
Well , so make quick tutorial in config as commented section
This returns a NamespacedKey. What even is a StoredItemKey?
true
Anyone else know how to make it so a class can return itself or a class extended from itself?
Your design is flawed. What ive sent you is the maximum you can do.
probably nothing, looks like they wanna declare a new variable without giving it any type
Average Python dev
hm
oh
figured it out
i'll just pass the class back in every method and then cast it based on what you pass back
Fk i got a meme prepared for when php comes up and now i cant find it 
Anyways. php bad
lol
php is great you guys are haters
You go explode your variables
$stmt->bind_param("ssssisssi", $order_firstname, $order_lastname, $order_notes, $order_phoneno, $order_amount, $addr_address, $addr_suburb, $addr_postcode, $order_vegan);
check out this badboy of a method
array index out of bounds
Check your array lenght before accessing it
Yeah I am stupid 🤣.
public <T extends LocationGeneratorCircular> T setInnerRadius(Class<T> cls, Object obj, double oInnerRadius) {
innerRadius = oInnerRadius;
return cls.cast(obj);
}
Solution for those interested
extra param 😦
Just pass T obj and leave the class
public <T extends LocationGeneratorCircular> T setInnerRadius(T obj, double oInnerRadius) {
innerRadius = oInnerRadius;
return obj;
}
Which makes the parameter utterly useless because the caller has it already.
Which results in
public void setInnerRadius(double oInnerRadius) {
innerRadius = oInnerRadius;
}
sort of ruins the point of a builder
why use it if you're just gonna pass the builder obj through a param anyway
decreases the amount of variables
well originally i had 1 big class which stored variables for every possible shape
That alone sounds like a nightmare
wheres 6
nvm
Som1 know why this isnt working ?
https://paste.md-5.net/emanewofub.java
And explide me how to fix it
poor lad
alex explained it to you already
well
now that i have the easy solution to rely on when i give up
i should think more about how to satisfy smile and buoobuoo
Aesopian it's possible if you only want one layer of inheritance for meta
yeah but i dont understand
what should i do
the issue is that this would add the 'angle' and 'orientation' parameters to the LocationGeneratorCircular class
public class LocationGeneratorSegment extends LocationGeneratorCircular {
public double arcAngle = 360;
public Vector orientation = new Vector(0.1, 0, 0);
public LocationGeneratorSegment setPointer(Vector orientation) {
this.orientation = orientation;
return this;
}
public LocationGeneratorSegment setAngle(double arcAngle) {
this.arcAngle = arcAngle;
return this;
}
}
I have this too, you see
right
For segments of circles or spheres.
I'm setting lore on an item and it doesn't show up
ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName(name);
meta.setLore(desc);
item.setItemMeta(meta);
BlockData has no PersistentDataContainer. If you use alex's API then this is the usage:
How can write in configs? 🤔
Show us, how u add up lore to the meta
Any console errors?
wdym?
nope
can i send me the link of this docs
pls
wait
ok nvm
Add a debug message after item.setItemMeta and see if it even gets called.
my list was empty, wrong config key
classic
Configs 💀
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
damn
@SuperBuilder
@Getter
@Setter
public class LocationGeneratorMeta{
private boolean noSolids = true;
}```
```java
@SuperBuilder
@Getter
@Setter
public class CircularGenerator extends LocationGeneratorMeta{
private double outerRadius = 10;
private double innerRadius = 0;
}
@drowsy helm havent used Lombok before
CircularGenerator circularGenerator = CircularGenerator.builder().innerRadius(1).noSolids(true).build();```
results in that
Thanks :).
lombok is great but can cause some issues at compile
does it cause any lag
does the code it generates cause lag
no
okay
how would it cause lag?
idk
@Getter
@Setter
public class MyClass{
private int myInt;
}
on compile becomes
public class MyClass{
private int myInt;
public int getMyInt(){
return myInt;
}
public void setMyInt(int myInt){
this.myInt = myInt;
}
it saves heaps of space coding
but like i said alot of other devs don't like it
but their SuperBuilder annotation would solve your issue
lombok adds a Thread.sleep(10) in every getter to delay them by 10ms
This makes the server lag big time 
lmao
@lost matrix were you able to figure out how that one product was able to create those UI's with the buttons?
fileConfiguration.addDefaults(CONFIG_DEFAULTS);
if (!configFile.exists()) {
fileConfiguration.options().copyDefaults(true);
saveConfig();
}
Is this a bad practice
I feel like this is better than using saveDefaultConfig
these
They use inventories for the clicks. You can decrease the bar size between the upper and lower inventory so
that you have a 9x9 area
i had a resource on the forums for that specifically
all the github links are fucked tho
werent the buttons something special? like they had their own click region that wasnt a collection of slots
Which method is better?
- update the scoreboard every x seconds
- update it only when it should get updated
Nope. Looked to me as they had the same constraints as inventories
last option is best
how?
doesnt let me access build methods from the class it is extended from
ok thank you
wdym?
nvm
i lied
LOL
this
does seem to work though
...why does this work
what does superbuilder do, @drowsy helm ?
what... form of magic is this?
hmm... . . . . . . .
same as the @Builder annotation but works with inheritance
why didn't @lost matrix suggest this?
i feel like i'm purchasing crack.
there is too much upside.
because the code is generated on compile
it is
and i'll probably use it
but
i just really want to know what 'superbuilder' /does/
like what is its mechanism of action
yeah
i just really want to rule out it causing more lag
the entire reason im doing this is because my math causes lag
lombok doesn't cause lag
if you say so!
it maybe makes your compile 10 milliseconds longer
thats the only lag you will experience
yeah im fine with compile lag
id compile for a day if it saved the server milliseconds
Lombok only affects the compile stage. It just adds the methods that you are not adding by using Lombok. Like the getters and setter methods
these 2 pieces of code
compile into the same thing
they are both exactly the same at runtime
lombok just simplifies it on the developer's end to make it more readable
Verify dude
can i build something WITHOUT assigning every variable?
?img
Not verified? Upload screenshots here: https://prnt.sc/
like
egsblain
???????
Put them in the global scope and never access them?
On IntelliJ, it now says 'Variable initializer is redundant'.
About the only way unless you bypass the compiler checks.
But then you’ll get nothing done.
@SuperBuilder
@Getter
@Setter
public class LocationGeneratorMeta {
public Location origin = null;
public Integer locationNumber = 1;
public boolean seekGround = true;
public boolean noSolids = true;
public List<Location> endLocationList = new ArrayList<>();
// public List<Location> getLocationlist() {
// return endLocationList;
// }
//
// public LocationGeneratorMeta setLocation(Location loc) {
// origin = loc;
// return this;
// }
//
// public LocationGeneratorMeta setPoints(Integer pnts) {
// locationNumber = pnts;
// return this;
// }
//
// public LocationGeneratorMeta setSeekGround(Boolean seek) {
// seekGround = seek;
// return this;
// }
//
// public LocationGeneratorMeta setNoSolids(Boolean slds) {
// noSolids = slds;
// return this;
// }
}
when I hover over one of those variables
it goes
make them private
Variable 'origin' initializer 'null' is redundant
That’s just a warning.
You can ignore it.
ah great
because I'd like to not have to assign EVERY variable every time I build something
I want to have a few defaults
like number of locations to 1 etc.
Unless it says it’s an error and underlined in red, then you can most likely just ignore them.
The only ones that you’d want to pay attention to is dead code warnings or similar stuff.
So am i off my rocker or is this a bug in spigot?
Here is the situation:
Im trying to check when a player right clicks an Ender_Eye (and check if it has my custom data and all that)
And let me preface that im not a new developer or anything, i just want to ensure nothing has changed from 1.19.2-1.19.3 that im not heretical about.
-
I can trigger my event to see whats in my hands (interact event, left click) and i get the following:
PlayerInteractEventItemStack{AIR x 0} ItemStack{ENDER_EYE x 1}(offhand, main hand) which is correct, the main hand contains an endereye -
i can trigger the same with a different consumable like an enderpearl and get the following:
PlayerInteractEventItemStack{AIR x 0} ItemStack{ENDER_PEARL x 1}(also correct)
Here is where the issue is:
i spend the enderpearl (right click / trigger its throw)
Enderpearl: PlayerInteractEventItemStack{AIR x 0} ItemStack{ENDER_PEARL x 1} (this reflects the pearl)
Endereye: PlayerInteractEventItemStack{AIR x 0} ItemStack{AIR x 0} (this SHOULD) reflect the ender eye, but it does not.
This is my check as a snippet: so you can see what im replicating:
@EventHandler
public void on(PlayerInteractEvent e) {
Plugin.info("PlayerInteractEvent" + e.getPlayer().getInventory().getItemInOffHand() + " " + e.getPlayer().getInventory().getItemInMainHand());
...
and here is a gif of the situation:
as you can see the interaction reflects the pearls correctly, but does not reflect the eyes correctly.
https://gfycat.com/UnluckyPositiveCobra (you can see it in hd if you click the little hd button)
Now, i already looked around but i could have totally missed the change if they changed where this event trigger for eyes is, but i dont think thats the prpblem, nor do i think they would change that.
Sorry for the page of text, i hate sending small bits of messages when i can just dump explain all in one
sounds like a bug to me
im guessing the two items are consumed differently
if you try and cancel the ender eye one does it work?
That works, and i cant cancel the eye because it is firing the event AFTER the item is consumed
And i can have a stack of 2 of them and it will throw one eye, and do nothing with the second , but if i do the same with enderpearls it cancels both
It just seems like its misordered
yeah doesn't sound right
plr.sendMessage(ChatColor.WHITE + "[" + ChatColor.DARK_RED + "Loup Garou" + ChatColor.WHITE + "]" +
" Les données sont entrain d'être supprimées...");
for (int i = 1; i < 3; i++) {
plugin.getConfig().set("roles.loup-" + i, "None");
}
plugin.getConfig().set("roles.loup-pere", "None");
plugin.getConfig().set("roles.mechant-loup", "None");
plugin.getConfig().set("roles.loup-blanc", "None");
plugin.getConfig().set("roles.voyante", "None");
plugin.getConfig().set("roles.sorciere", "None");
plugin.getConfig().set("roles.ange", "None");
for (int i = 1; i < 7; i++) {
plugin.getConfig().set("roles.villageois-" + i, "None");
}
plugin.saveConfig();
plr.sendMessage(ChatColor.WHITE + "[" + ChatColor.DARK_RED + "Loup Garou" + ChatColor.WHITE + "]" +
" Les données sont supprimées.");
return true;
``` Why once I do this, my value are not Strings?
roles:
loup-1: None
loup-2: None
loup-3: None
loup-pere: None
mechant-loup: None
loup-blanc: None
voyante: None
sorciere: None
ange: None
villageois-1: None
villageois-2: None
villageois-3: None
villageois-4: None
villageois-5: None
villageois-6: None
villageois-7: None
``` After.
roles:
loup-1: "None"
loup-2: "None"
loup-3: "None"
loup-pere: "None"
mechant-loup: "None"
loup-blanc: "None"
voyante: "None"
sorciere: "None"
ange: "None"
villageois-1: "None"
villageois-2: "None"
villageois-3: "None"
villageois-4: "None"
villageois-5: "None"
villageois-6: "None"
villageois-7: "None"
``` Before.
setString
ah nvm im bugging
im trying so that my scoreboard shows the rank of a player but everytime i put %vault_rank% on the config my scoreboard js disappears how can i fix this
You'll create unreadable code
you shouldn't add the path separator manually
instead use PATH.separator for them slashes
not that it matters anymore I suppose
im trying so that my scoreboard shows the rank of a player but everytime i put %vault_rank% on the config my scoreboard js disappears how can i fix this
you dont really need to check if it exists
saveDefaultConfig doesnt overwrite anything
Why do i keep getting the "NullPointerException" didnt get it in my other plugin on the same stuff, im so confused
i get it on this line
getCommand("animation").setExecutor(new crateAnimation(this));
at
.setExecutor
did you register the command on the plugin.yml
in an EntityDamageByEntityEvent, how do you get the person that attacked the player?
if the person that attacked used an arrow
A few extra steps but you can check if the damager is a Projectile. If it is, call getShooter(). Check if the shooter is a Player. If it is, you've got your killer
if (event.getDamager() instanceof Projectile projectile && !(projectile.getShooter() instanceof Player killer)) {
return;
}
killer.sendMessage("hi you killed them");```
(checking for a Projectile instead of an arrow will support other projectiles as well btw)
Lmao for being real, idk how Velocity Is going to be the proxies future. Startim from it's horrible api where you dont even implements a base class for plugins. Instead you use some really ugly injections vía @Inject.
Lmfao, not even going to code any plugin for that.
Also you use events for plugin activation and deactivation
Well it's done by paper whats More i can expect Hahahaha
how can i code a lifesteal plugin but it only applies when the player uses a specific weapon?
and that weapon dissapears after a kill?
oh
If you are on newer versions (1.16 and up, if im not wrong) you can use PDC, to add custom meta to the item
Thought it was 1.14
1.14.4 and up afaik
Whats the issue with that if I may ask?
Sure its a bit of an opinionated way, but I don’t see the big starving point here
Not much. Just opts to make use of Guice
is there a way to add a dependency to all modules?
without putting the dependency in each one
add it to the parent pom
you can still do relocation in the module pom
anything in the parent pom applies to all the modules unless overriden by the module
if you don't specify the shade stuff in the parent pom, then obviously each module has to handle the shading itself
so, nothing to worry about for you except just moving where the dependency is specified
I never said you don't need it, just said you can leave the shade stuff as it is
You would put the shade plugin wherever you need to use it
ah
Maven works in a hierarchy. Think of it like all the repositories, dependencies, and build settings are copied from the parent and pasted into all its children
May need to refresh or rebuild
^
i just did, let me try again
Especially in IJ, Maven needs to be rebuilt every time you change something in the pom
Yeah whichever one it is that needs it
awesome, thanks so much!
does this look good?
@Override
public List<HoeEnchant> getEnchants() {
List<HoeEnchant> enchants = new ArrayList<>();
for (HoeEnchant enchant : HoeEnchant.values()) {
if (nbtItem.getInteger(enchant.name()) > 0) {
enchants.add(enchant);
}
}
return enchants;
}```
just wanting some clarification
not sure if this will work
isn't there like only one hoeEnchant o.O
ah
would that be the best way of doing that?
What versions are you working on?
wtf is that
?pdc
ahh
You can store persistent data in a lot of things. Makes NBTApi mostly useless.
Also NBTApi uses reflections iirc which is for sure slower than Spigots API.
Btw you can actually register custom enchantments.
but you really shouldn't
when given an itemstack would the best way to find like the custom enchants (from lore) and getting like the amount of kills like if the line contains "Kills: then split it then or is there a better way?
Does BungeeCord send signed chats by default or no?
Or is it just the unverified chats banner?
Put it in the PDC if the ItemStack.
The lore should be purely visual and not contain any data
when did that get added?
1.14
mmm i support 1.16 through 1.8
Then at least use NBTItem
then how would i go about adding a new enchant in a specific place?
or adding a new line or editing a specific line on the itemstack
Every time you change the data if your item you should update the lore of your ItemStack depending on all the data.
A method (data) -> (lore) which creates a new representation of your lore every time your data changes.
How can I automatically include the project version set in the POM.xml file in the compiled output of my IntelliJ IDEA project? I have already searched for solutions on Google.
<filtered>true</filtered> in your resources section of your pom
how is that helping me?
any values available to mvn will be available to your plugin.yml
you just have to insert the correct field
can i just insert this "${project.version}" in artifact?
you add that to your plugin.yml and it will be replaced when your jar is built
its already added
i dont mean version in plugin.yml
i want version on jar output
like
plugin-version.jar
oh you want it in the actual compiled source?
yeah
yes you can set a final name in your pom
<jar.finalName>${project.name}</jar.finalName> in your properties section
thx
put whatever you want in there
Whoa, you don't need that tag. You can just set a final name under the build section.
<build>
<finalName>WhateverYouWantToNameIt<finalName>
</build>
maybe because i have artifact with custom name?
yes
so just remove it?
I have it under properties as I have everythgin that can be edited there
but if i delete artifact it change's compile directory
?paste pom
its no longer creating artifacts folder but still version is not included in the compile output
its just duels.jar
add teh version placeholder in teh jar.finalName entry
That's cause you never specify a final build name under the build section.
That's under the <properties> tag, not the <build> tag.
oh right
properties tag is just fine
it keeps it all in teh same place for editable entries
True, but you still have to include that variable in the build section using the <finalName> tag.
no you don't
<jar.finalName>${project.name}-${project.version}</jar.finalName>
its
still
duels.jar
sec let me pull up a jar that actually uses a custom name
ok
?paste
This https://paste.md-5.net/asisuqiqej.xml builds Groupmanager1234.jar
ill try to insert just numbers instead of version placeholder
still
duels.jar
what im doing is clicking on build>build artifacts>build
if not with artifact
this <jar.finalName>${project.name}-${project.version}</jar.finalName> builds GroupManager-3.0-SNAPSHOT.jar
how do i compile it?
Just set the <finalName> in the build section. Then use the project flag as part of the name. This is guaranteed to work.
<build>
<finalName>Duels-${project.version}</finalName>
</build>
right side of screen -> maven tab -> lifecycles -> package
you mean this?
Use this button to run maven commands. clean package is what you'll need to run.
You can also setup a <defaultGoal> in your <build> section to use the automatic maven build tool built into maven so that it does that for you.
Maven's on the right side.
the M in teh right column
Click that button
Yea, it's working
now look in the target folder
^
I need some brainstorming support. I am currently writing a plugin which involves machines.
- Machines need energy
- Energy needs to be distributed via energy connections
- Connections can be established between machines and poles (poles are technically also machines)
- A machine can either consume or produce energy
- Every machine has an internal energy storage for buffering
Now i have a few design problems i need to tackle:
Distributing energy:
Should every machine simply "send" or "draw" energy to/from every other machine
when they get ticked? Every machine would have to traverse the network like a graph then.
Or should the network be its own object which has decentralized, collective energy storage
and every machine simply interacts with only the network storage.
I can argue for both cases and there are more questions for each case.
Example concerns for the network object case:
- When do networks get loaded and who keeps track of networks?
- How do i handle two networks being connected together?
Any thoughts are appreciated
where is that target
Should be in the root of your project folder.
I'd just draw, IF there is a provider in range/connected and there is buffer space
You can do that with the <directory> tag in the <build> section.
<build>
<directory>../path/to/wherever</directory>
</build>
whats difference between this two
thx
If you only draw when there is buffer space machines which are full would nto tick
no work, no draw = no tick
<directory>C:\Users\PC\IdeaProjects\Duels\target</directory>
IIRC, that's the default directory anyways, but it should show up in the file browser on the left there.
So you would check the network like a graph every time a machine ticks and simply draw from
producers if they are in range. This makes sense but what about fairness? If i have 3 consumers
which use 100/s and 1 producer who produces 150/s then i want the energy to be evenly distributed
between them. If i now go ahead and let the first consumer draw then the second only gets 50 and the
last one never gets anything. I would prefer behavior where everyone gets 50/s
only allow a machine to draw from another node until it's less than or equal to the providers energy store
so one machien can;t empty anothers cache
the network will balance it's energy
yeah i can see it but i want it in specific directory
and you only need to tick each machine and draw from connected nodes
Well, which one? Cause right now, the one you provided is equivalent to the default path.
Directly connected, no need to seach the network for more power
wdym
oh
i remember i copied my directory's path
sorry for being dumb
Hm you brought an idea to me. I could never let anyone draw from others. I simply only let producers
push out their energy to connected consumers. So if a producer gets ticked and has 100 energy to give
he goes through the network and finds all consumers. Then he simply gives every consumer (which can take it)
100 / N energy.
You could do it that way, less work too
No, just the build directory. Hence why it's under the build tag.
then why are there that folders appearing?
so producers would be generators and poles
It's part of the build process. You can ignore them as the jar file is what you'll be after.
why does it compile two jars. original- and default?
Hm poles either need to be neutral, so just a node for iteration.
Or they need to be producers and consumers at the same time.
yep
I don't fully know why it does that.
if you are pushign then poles have to be both
But the latter would dilute the energy distribution because of the energy / N fairness.
So i would rather make them neutral.
But, you shouldn't copy the one labeled original
why is it compiling two jars?
neutral would only work if you also have machines pull
second one is the one to use
whats the point
original is before shading etc
how can i set it to atomatically delete?
stop being finicky
Why would neutral only work if i have machines pulling energy?
If a producer pushes energy then he traverses the network like a graph,
puts all found consumers in a list and gives them energy. A pole would simply
be a Node in the network without consuming or producing energy.
if you are tryign to auto deploy there are plugins for that
I wouldn't worry about it. It's a small jar since it contains pre shaded code. It's minuscule, but running the maven command clean will remove that directory entirely.
ah ok I assumed poles would have an energy cache
Yeah would make sense...
meh okay
But only if they are consuming and producing. I think ill make them energy less tho.
makes sense, less to tick
Relax, it's a small directory and that's from one of my projects. Yours will likely be smaller in size.
I think i will actually create an energy policy for machines where they can either push, pull or do nothing.
This way the user can cycle through that. Producers will have push on default and Consumers will have no strategy on default.
This brings up a bunch of implementation problems but i think i can figure those out.
So long as your pull policy only attempts to balance energy it should be fine
Are you trying to make a system that mimics real electrical systems? Or is this something similar to electrical mods?
else you have one machine pull from another, then the other machine ticks and it pulls back
No im orienting myself on systems like IC2 or Thermal Expansion
If i would create an electrical system i would be here for weeks. Im studying electrical engineering and i would probably
try too hard to make this accurate. And it would be less fun to play.
Yes i see what you mean there.
IIRC those machines from the mods were setup in a way that some machines could also act as a passthrough. However, most of them were a simple desgin.
Generator ---> Electrical Wire ---> Output Device