Search in sources :

Example 6 with PartiesPlugin

use of com.alessiodp.parties.common.PartiesPlugin in project Parties by AlessioDP.

the class CensorUtilsTest method setUp.

@BeforeAll
public static void setUp() {
    PartiesPlugin mockPlugin = mock(PartiesPlugin.class);
    LoggerManager mockLoggerManager = mock(LoggerManager.class);
    when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
    when(mockLoggerManager.isDebugEnabled()).thenReturn(true);
    doAnswer((args) -> {
        System.out.println((String) args.getArgument(0));
        return null;
    }).when(mockLoggerManager).logDebug(anyString(), anyBoolean());
    staticPlugin = Mockito.mockStatic(ADPPlugin.class);
    when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
Also used : PartiesPlugin(com.alessiodp.parties.common.PartiesPlugin) LoggerManager(com.alessiodp.core.common.logging.LoggerManager) ADPPlugin(com.alessiodp.core.common.ADPPlugin) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 7 with PartiesPlugin

use of com.alessiodp.parties.common.PartiesPlugin in project Parties by AlessioDP.

the class PartiesYAMLDispatcher method getPlayerFromNode.

private PartyPlayerImpl getPlayerFromNode(ConfigurationSection node) {
    PartyPlayerImpl ret = null;
    if (node != null) {
        ret = ((PartiesPlugin) plugin).getPlayerManager().initializePlayer(UUID.fromString(node.getName()));
        ret.setAccessible(true);
        if (node.getString("party") != null) {
            ret.setPartyId(UUID.fromString(node.getString("party", "")));
            ret.setRank(node.getInt("rank"));
        }
        ret.setSpy(node.getBoolean("options.spy", false));
        ret.setMuted(node.getBoolean("options.mute", false));
        ret.setAccessible(false);
    }
    return ret;
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartiesPlugin(com.alessiodp.parties.common.PartiesPlugin)

Example 8 with PartiesPlugin

use of com.alessiodp.parties.common.PartiesPlugin in project Parties by AlessioDP.

the class PartiesYAMLDispatcher method getPartyFromNode.

private PartyImpl getPartyFromNode(ConfigurationSection node) {
    PartyImpl ret = null;
    if (node != null) {
        ret = ((PartiesPlugin) plugin).getPartyManager().initializeParty(UUID.fromString(node.getName()));
        ret.setAccessible(true);
        ret.setup(node.getString("name"), node.getString("leader"));
        ret.setDescription(node.getString("tag"));
        ret.setDescription(node.getString("description"));
        ret.setMotd(node.getString("motd"));
        ret.setColor(((PartiesPlugin) plugin).getColorManager().searchColorByName(node.getString("color")));
        ret.setKills(node.getInt("kills"));
        ret.setPassword(node.getString("password"));
        ret.getHomes().addAll(PartyHomeImpl.deserializeMultiple(node.getString("home")));
        ret.setProtection(node.getBoolean("protection", false));
        ret.setExperience(node.getDouble("experience"));
        ret.setFollowEnabled(node.getBoolean("follow", true));
        if (node.isSet("isopen"))
            ret.setOpenNullable(node.getBoolean("isopen"));
        ret.setAccessible(false);
        // Members check
        if (node.getStringList("members") != null) {
            for (String id : node.getStringList("members")) {
                try {
                    ret.getMembers().add(UUID.fromString(id));
                } catch (Exception ex) {
                    plugin.getLoggerManager().logError(Constants.DEBUG_DB_FILE_ERROR, ex);
                }
            }
        }
    }
    return ret;
}
Also used : PartiesPlugin(com.alessiodp.parties.common.PartiesPlugin) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 9 with PartiesPlugin

use of com.alessiodp.parties.common.PartiesPlugin in project Parties by AlessioDP.

the class PartyRowMapper method map.

@Override
public PartyImpl map(ResultSet rs, StatementContext ctx) throws SQLException {
    PartyImpl ret = ((PartiesPlugin) ADPPlugin.getInstance()).getPartyManager().initializeParty(UUID.fromString(rs.getString("id")));
    ret.setAccessible(true);
    ret.setup(rs.getString("name"), rs.getString("leader"));
    ret.setTag(rs.getString("tag"));
    ret.setDescription(rs.getString("description"));
    ret.setMotd(rs.getString("motd"));
    ret.setColor(((PartiesPlugin) ADPPlugin.getInstance()).getColorManager().searchColorByName(rs.getString("color")));
    ret.setKills(rs.getInt("kills"));
    ret.setPassword(rs.getString("password"));
    ret.getHomes().addAll(PartyHomeImpl.deserializeMultiple(rs.getString("home")));
    ret.setProtection(rs.getBoolean("protection"));
    ret.setExperience(rs.getDouble("experience"));
    ret.setFollowEnabled(rs.getBoolean("follow"));
    boolean isopen = rs.getBoolean("isopen");
    if (!rs.wasNull())
        ret.setOpenNullable(isopen);
    ret.setAccessible(false);
    return ret;
}
Also used : PartiesPlugin(com.alessiodp.parties.common.PartiesPlugin) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 10 with PartiesPlugin

use of com.alessiodp.parties.common.PartiesPlugin in project Parties by AlessioDP.

the class VelocityPartiesCommandManager method registerCommands.

@Override
public void registerCommands() {
    mainCommands = new ArrayList<>();
    mainCommands.add(new VelocityCommandParty((PartiesPlugin) plugin));
    mainCommands.add(new VelocityCommandP((PartiesPlugin) plugin));
}
Also used : VelocityCommandP(com.alessiodp.parties.velocity.commands.main.VelocityCommandP) PartiesPlugin(com.alessiodp.parties.common.PartiesPlugin) VelocityCommandParty(com.alessiodp.parties.velocity.commands.main.VelocityCommandParty)

Aggregations

PartiesPlugin (com.alessiodp.parties.common.PartiesPlugin)16 PartyImpl (com.alessiodp.parties.common.parties.objects.PartyImpl)9 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)6 User (com.alessiodp.core.common.user.User)4 BukkitUser (com.alessiodp.core.bukkit.user.BukkitUser)2 ADPPlugin (com.alessiodp.core.common.ADPPlugin)2 PartiesCommandData (com.alessiodp.parties.common.commands.utils.PartiesCommandData)2 PartiesConfigurationManager (com.alessiodp.parties.common.configuration.PartiesConfigurationManager)2 PartiesPacket (com.alessiodp.parties.common.messaging.PartiesPacket)2 PartyHomeImpl (com.alessiodp.parties.common.parties.objects.PartyHomeImpl)2 ByteArrayDataInput (com.google.common.io.ByteArrayDataInput)2 Location (org.bukkit.Location)2 ADPMainCommand (com.alessiodp.core.common.commands.utils.ADPMainCommand)1 CommandData (com.alessiodp.core.common.commands.utils.CommandData)1 LoggerManager (com.alessiodp.core.common.logging.LoggerManager)1 DeleteCause (com.alessiodp.parties.api.enums.DeleteCause)1 JoinCause (com.alessiodp.parties.api.enums.JoinCause)1 LeaveCause (com.alessiodp.parties.api.enums.LeaveCause)1 IPartyGetExperienceEvent (com.alessiodp.parties.api.events.common.party.IPartyGetExperienceEvent)1 IPartyLevelUpEvent (com.alessiodp.parties.api.events.common.party.IPartyLevelUpEvent)1