本文整理汇总了Java中handling.world.exped.ExpeditionType类的典型用法代码示例。如果您正苦于以下问题:Java ExpeditionType类的具体用法?Java ExpeditionType怎么用?Java ExpeditionType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExpeditionType类属于handling.world.exped包,在下文中一共展示了ExpeditionType类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createParty
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public static MapleParty createParty(MaplePartyCharacter chrfor, int expedId) {
ExpeditionType ex = ExpeditionType.getById(expedId);
MapleParty party = new MapleParty(runningPartyId.getAndIncrement(), chrfor, ex != null ? runningExpedId.getAndIncrement() : -1);
parties.put(party.getId(), party);
if (ex != null) {
final MapleExpedition exp = new MapleExpedition(ex, chrfor.getId(), party.getExpeditionId());
exp.getParties().add(party.getId());
expeds.put(party.getExpeditionId(), exp);
}
return party;
}
示例2: getSpeedRun
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public Triple<String, Map<Integer, String>, Long> getSpeedRun(String typ) {
final ExpeditionType expedtype = ExpeditionType.valueOf(typ);
if (SpeedRunner.getSpeedRunData(expedtype) != null) {
return SpeedRunner.getSpeedRunData(expedtype);
}
return new Triple<String, Map<Integer, String>, Long>("", new HashMap<Integer, String>(), 0L);
}
示例3: loadSpeedRuns
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static void loadSpeedRuns() {
if (speedRunData.size() > 0) {
return;
}
for (ExpeditionType type : ExpeditionType.values()) {
loadSpeedRunData(type);
}
}
示例4: loadSpeedRunData
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static void loadSpeedRunData(ExpeditionType type) {
try {
StringBuilder ret; //or should we do less
Map<Integer, String> rett;
boolean changed;
long tmp;
try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM speedruns WHERE type = ? ORDER BY time LIMIT 25")) {
ps.setString(1, type.name());
ret = new StringBuilder(getPreamble(type));
rett = new LinkedHashMap<>();
try (ResultSet rs = ps.executeQuery()) {
int rank = 1;
Set<String> leaders = new HashSet<>();
boolean cont = rs.first();
changed = cont;
tmp = 0;
while (cont) {
if (!leaders.contains(rs.getString("leader"))) {
addSpeedRunData(ret, rett, rs.getString("members"), rs.getString("leader"), rank, rs.getString("timestring"));
rank++;
leaders.add(rs.getString("leader"));
tmp = rs.getLong("time");
}
cont = rs.next() && rank < 25;
}
}
}
if (changed) {
speedRunData.put(type, new Triple<>(ret.toString(), rett, tmp));
}
} catch (SQLException e) {
}
}
示例5: getRankAndAdd
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public void getRankAndAdd(String leader, String time, ExpeditionType type, long timz, Collection<String> squad) {
try {
long lastTime = SpeedRunner.getSpeedRunData(type) == null ? 0 : SpeedRunner.getSpeedRunData(type).right;
//if(timz > lastTime && lastTime > 0) {
//return;
//}
//Pair<String, Map<Integer, String>>
StringBuilder rett = new StringBuilder();
if (squad != null) {
for (String chr : squad) {
rett.append(chr);
rett.append(",");
}
}
String z = rett.toString();
if (squad != null) {
z = z.substring(0, z.length() - 1);
}
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("INSERT INTO speedruns(`type`, `leader`, `timestring`, `time`, `members`) VALUES (?,?,?,?,?)")) {
ps.setString(1, type.name());
ps.setString(2, leader);
ps.setString(3, time);
ps.setLong(4, timz);
ps.setString(5, z);
ps.executeUpdate();
}
if (lastTime == 0) { //great, we just add it
SpeedRunner.addSpeedRunData(type, SpeedRunner.addSpeedRunData(new StringBuilder(SpeedRunner.getPreamble(type)), new HashMap<Integer, String>(), z, leader, 1, time), timz);
} else {
//i wish we had a way to get the rank
//TODO revamp
SpeedRunner.removeSpeedRunData(type);
SpeedRunner.loadSpeedRunData(type);
}
} catch (SQLException e) {
}
}
示例6: getSpeedRunData
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static Triple<String, Map<Integer, String>, Long> getSpeedRunData(ExpeditionType type) {
return speedRunData.get(type);
}
示例7: addSpeedRunData
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static void addSpeedRunData(ExpeditionType type, Pair<StringBuilder, Map<Integer, String>> mib, long tmp) {
speedRunData.put(type, new Triple<>(mib.getLeft().toString(), mib.getRight(), tmp));
}
示例8: removeSpeedRunData
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static void removeSpeedRunData(ExpeditionType type) {
speedRunData.remove(type);
}
示例9: getPreamble
import handling.world.exped.ExpeditionType; //导入依赖的package包/类
public final static String getPreamble(ExpeditionType type) {
return "#rThese are the speedrun times for " + StringUtil.makeEnumHumanReadable(type.name()).toUpperCase() + ".#k\r\n\r\n";
}