Created
May 11, 2015 05:42
-
-
Save ZornTaov/621d0745876a90f0396b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//constants, I forgot how to make them AS constants, this could also be an Enum instead | |
public const MODE_EMPTY = 0; // 00000 | |
public const MODE_V = 1; // 00001 | |
public const MODE_H = 2; // 00010 | |
public const MODE_O = 4; // 00100 | |
public const MODE_A = 8; // 01000 | |
public const MODE_Q = 16; // 10000 | |
// adding the modes | |
if (modes.Contains("v")) { modechar |= MODE_V; } | |
if (modes.Contains("h")) { modechar |= MODE_H; } | |
if (modes.Contains("o")) { modechar |= MODE_O; } | |
if (modes.Contains("a")) { modechar |= MODE_A; } | |
if (modes.Contains("q")) { modechar |= MODE_Q; } | |
//removing the modes | |
modechar &= ~MODE_V; | |
//Toggle the mode | |
modechar ^= MODE_V; | |
// checking modes | |
if((modechar & MODE_O) == MODE_O) System.out.println("User has Op privligas"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment