Archived Faction Bug Fixes

This suggestion has been archived / closed and can no longer be voted on.
Status
Not open for further replies.

Imboring56

Seasoned Runner
Joined
Sep 9, 2012
Messages
1,423
Reaction score
1,673
Points
0
Age
26
Location
USA
There are two pretty minor bugs that I'd like to point out with solution changes in the GitHub code. They are both purely experimental, but in theory and because of the results of the tests I ran, they will probably work.

The first bug is the one where the disband message is sent across each rack server, and the number of times that message is sent is based on the number of rack servers. So right now, since there are 4 rack servers, on each rack server the message would be sent 4 times. When more rack servers are added in and a faction disbands, chat could be flooded pretty easily, and here is what I would add to the code in the /src/com/massivecraft/factions/event/FactionsEventDisband.java. From this:
Code:
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
 
import com.massivecraft.factions.entity.Faction;
public class FactionsEventDisband extends FactionsEventAbstractSender
{
    // -------------------------------------------- //
    // REQUIRED EVENT CODE
    // -------------------------------------------- //
 
    private static final HandlerList handlers = new HandlerList();
    @Override public HandlerList getHandlers() { return handlers; }
    public static HandlerList getHandlerList() { return handlers; }
 
    // -------------------------------------------- //
    // FIELDS
    // -------------------------------------------- //
 
    private final Faction faction;
    public Faction getFaction() { return this.faction; }
    private final String factionId;
    public String getFactionId() { return this.factionId; }
    // -------------------------------------------- //
    // CONSTRUCT
    // -------------------------------------------- //
 
    public FactionsEventDisband(CommandSender sender, Faction faction)
    {
        super(sender);
        this.faction = faction;
        this.factionId = faction.getId();
    }
}
To this:
Code:
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
 
import com.massivecraft.factions.entity.Faction;
 
public class FactionsEventDisband extends FactionsEventAbstractSender
{
    // -------------------------------------------- //
    // REQUIRED EVENT CODE
    // -------------------------------------------- //
 
    private static final HandlerList handlers = new HandlerList();
    @Override public HandlerList getHandlers() { return handlers; }
    public static HandlerList getHandlerList() { return handlers; }
 
    // -------------------------------------------- //
    // FIELDS
    // -------------------------------------------- //
 
    private final String universe;
    public final String getUniverse() { return this.universe; }
 
    private final Faction faction;
    public Faction getFaction() { return this.faction; }
    private final String factionId;
    public String getFactionId() { return this.factionId; }
 
    // -------------------------------------------- //
    // CONSTRUCT
    // -------------------------------------------- //
 
    public FactionsEventDisband(CommandSender sender, Faction faction)
    {
        super(sender);
        this.universe = universe;
        this.faction = faction;
        this.factionId = faction.getId();
    }
 
}

The changes made were:
1. A Private Final String universe was set up in the Fields section
2. In the Construct, in the FactionsEventDisband, this.universe was added in
3. Also, in the FactionsEventDisband, the String universe must be passed by reference to the function

And for the second bug, it really isn't a bug, just something I noticed that was changed. The descriptions, when changed, did not send a global message. If you add in the exact same changes that were used in the disband, I believe the description should be "fixed" as well. I will still keep looking through it for other small errors, and look for other ways to solve this if the problem isn't.
 
This suggestion has been closed. Votes are no longer accepted.
Go to github or contact cayorion personally
I don't have a GitHub and I don't believe I can edit the code and submit a bug report for that on there, and I don't want to give Cayorion another message to his inbox. I'll tag him as Cayorion so that he may take a look at this.

If any other coders like Cowboys1919 or I believe MonMarty want to take a look at this suggested solution, I've tagged you guys to this post.
 
I don't have a GitHub and I don't believe I can edit the code and submit a bug report for that on there, and I don't want to give Cayorion another message to his inbox. I'll tag him as Cayorion so that he may take a look at this.

If any other coders like Cowboys1919 or I believe MonMarty want to take a look at this suggested solution, I've tagged you guys to this post.

Well, simply declaring a new method (public final String getUniverse() { return this.universe; }) won't do anything. If it it not implemented anywhere else, nothing would change. It's a bit more complicated.

If Cayorion wanted to fix it, he could probably do so in a few minutes. I think it's more likely that the bug hasn't even been brought to his attention or it's relative unimportance has pushed it aside to work on other tasks.

Also, I think that the descriptions not sending global messages is on purpose. It's just spammy and not needed.
 
Very good point. I believe it is in this file that something needs to be changed. Going to look through it for a while.
 
Nah the duplicate messages are more complex than you might think. It's beyond a simple typo in the source somewhere.
 
Do you have time to fix it or is it just a minor bug?
 
Status
Not open for further replies.