테스트

aion-server 4.8

Gitteol
최고관리자 · 1 · 💬 0 클론/새로받기
 4.8 61f661d · 1 commits 새로받기(Pull)
game-server/data/handlers/admincommands/Instance.java
package admincommands;

import static com.aionemu.gameserver.configs.main.AutoGroupConfig.*;

import com.aionemu.gameserver.model.autogroup.AutoGroupType;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
import com.aionemu.gameserver.services.instance.PeriodicInstanceManager;
import com.aionemu.gameserver.utils.chathandlers.AdminCommand;

/**
 * @author ViAl, Estrayl
 */
public class Instance extends AdminCommand {

	public Instance() {
		super("instance", "Activates or deactivates registration for pvp instances.");

		// @formatter:off
			setSyntaxInfo(
							"<open|close> dredgion - Opens/closes the registration for Dredgion (6vs6)",
							"<open|close> id - Opens/closes the registration for Idgel Dome (6vs6)",
							"<open|close> eob - Opens/closes the registration for Engulfed Ophidan Bridge (6vs6)",
							"<open|close> kb - Opens/closes the registration for Kamar Battlefield (12vs12)",
							"<open|close> iww - Opens/closes the registration for Iron Wall Warfront (24vs24)"
			);
			// @formatter:on
	}

	@Override
	public void execute(Player player, String... params) {
		if (params.length < 2) {
			sendInfo(player);
			return;
		}
		if (params[0].equalsIgnoreCase("open"))
			openRegistration(player, params[1]);
		else if (params[0].equalsIgnoreCase("close"))
			closeRegistration(player, params[1]);
	}

	private void openRegistration(Player admin, String instanceName) {
		SM_SYSTEM_MESSAGE openingMsg;
		int maskId;
		long registrationPeriod;

		switch (instanceName.toLowerCase()) {
			case "dredgion" -> { // Only opening Terath Dredgion
				openingMsg = SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_IDDREADGION_03();
				maskId = 3;
				registrationPeriod = DREDGION_REGISTRATION_PERIOD;
			}
			case "eob" -> {
				openingMsg = SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_IDLDF5_Under_01_War();
				maskId = 108;
				registrationPeriod = ENGULFED_OPHIDAN_BRIDGE_REGISTRATION_PERIOD;
			}
			case "id" -> {
				openingMsg = SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_IDLDF5_Fortress_Re();
				maskId = 111;
				registrationPeriod = IDGEL_DOME_REGISTRATION_PERIOD;
			}
			case "iww" -> {
				openingMsg = SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_IDF5_TD_war();
				maskId = 109;
				registrationPeriod = IRON_WALL_WARFRONT_REGISTRATION_PERIOD;
			}
			case "kb" -> {
				openingMsg = SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_IDKamar();
				maskId = 107;
				registrationPeriod = KAMAR_BATTLEFIELD_REGISTRATION_PERIOD;
			}
			default -> {
				openingMsg = null;
				maskId = 0;
				registrationPeriod = 0;
			}
		}
		if (maskId != 0) {
			if (PeriodicInstanceManager.getInstance().openRegistration(openingMsg, maskId, registrationPeriod))
				sendInfo(admin, "Registration for " + AutoGroupType.getAGTByMaskId(maskId) + " is now open.");
			else
				sendInfo(admin, "Registration for " + AutoGroupType.getAGTByMaskId(maskId) + " is already open.");
		} else {
			sendInfo(admin, "No instance found for " + instanceName);
		}
	}

	private void closeRegistration(Player admin, String instanceName) {
		int maskId;

		switch (instanceName.toLowerCase()) {
			case "dredgion" -> maskId = 3;
			case "eob" -> maskId = 108;
			case "id" -> maskId = 111;
			case "iww" -> maskId = 109;
			case "kb" -> maskId = 107;
			default -> maskId = 0;
		}

		if (maskId != 0) {
			if (PeriodicInstanceManager.getInstance().closeRegistration(maskId))
				sendInfo(admin, "Registration for " + AutoGroupType.getAGTByMaskId(maskId) + " is now closed.");
			else
				sendInfo(admin, "Registration for " + AutoGroupType.getAGTByMaskId(maskId) + " is not open.");
		} else {
			sendInfo(admin, "No instance found for " + instanceName);
		}
	}

}

📎 첨부파일

댓글 작성 권한이 없습니다.
🏆 포인트 랭킹 TOP 10
순위 닉네임 포인트
1 no_profile 타키야겐지쪽지보내기 자기소개 아이디로 검색 전체게시물 100,792
2 no_profile 동가리쪽지보내기 자기소개 아이디로 검색 전체게시물 58,079
3 no_profile 라프텔쪽지보내기 자기소개 아이디로 검색 전체게시물 51,771
4 no_profile 불멸의행복쪽지보내기 자기소개 아이디로 검색 전체게시물 36,923
5 서번트쪽지보내기 자기소개 아이디로 검색 전체게시물 35,011
6 no_profile 보거스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,969
7 no_profile 닥터스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,470
8 no_profile 검은고양이쪽지보내기 자기소개 아이디로 검색 전체게시물 29,077
9 no_profile Revolution쪽지보내기 자기소개 아이디로 검색 전체게시물 28,199
10 no_profile 호롤롤로쪽지보내기 자기소개 아이디로 검색 전체게시물 17,020
알림 0