001/* 002 * Trident - A Multithreaded Server Alternative 003 * Copyright 2014 The TridentSDK Team 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package net.tridentsdk.effect.potion; 018 019import java.util.HashMap; 020import java.util.Map; 021 022/** 023 * Represents the types of potion effects 024 * 025 * @author The TridentSDK Team 026 * @since 0.4-alpha 027 */ 028public enum PotionEffectType { 029 SPEED(1), 030 SLOWNESS(2), 031 HASTE(3), 032 MINING_FATIGUE(4), 033 STRENGTH(5), 034 INSTANT_HEALTH(6), 035 INSTANT_DAMAGE(7), 036 JUMP_BOOST(8), 037 NAUSEA(9), 038 REGENERATION(10), 039 RESISTANCE(11), 040 FIRE_RESISTANCE(12), 041 WATER_BREATHING(13), 042 INVISIBILITY(14), 043 BLINDNESS(15), 044 NIGHT_VISION(16), 045 HUNGER(17), 046 WEAKNESS(18), 047 POISON(19), 048 WITHER(20), 049 HEALTH_BOOST(21), 050 ABSORPTION(22), 051 SATURATION(23); 052 private static Map<Byte, PotionEffectType> byId = new HashMap<>(); 053 054 static { 055 for (PotionEffectType type : values()) { 056 byId.put(type.id(), type); 057 } 058 } 059 060 private byte id; 061 062 PotionEffectType(int id) { 063 this.id = (byte) id; 064 } 065 066 public static PotionEffectType fromId(int id) { 067 return byId.get((byte) id); 068 } 069 070 public byte id() { 071 return id; 072 } 073}