public void OnSetRole(PlayerSetRoleEvent ev) { if (this.rolesWithoutInventory.Contains(ev.Role)) { return; } IConfigFile config = ConfigManager.Manager.Config; string shard = DIEventHandler.ConvertRoleIDToString(ev.Role); int[] items = config.GetIntListValue("default_item_" + shard, true); foreach (Item item in ev.Player.GetInventory()) { item.Remove(); } Timer operate = new Timer { Interval = 50, AutoReset = false, Enabled = true }; operate.Elapsed += delegate { foreach (Item item in ev.Player.GetInventory()) { item.Remove(); } foreach (int item in items) { if (item == -1) { continue; } ev.Player.GiveItem((ItemType)item); } }; }