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);
}
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;
}
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;
}
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;
}
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));
}
Aggregations