예제 #1
0
 private double getDistanceTo(double x, double y, double z, Player player) {
   double x2 = player.getX();
   double y2 = player.getY();
   double z2 = player.getZ();
   double xResult = java.lang.Math.pow(java.lang.Math.max(x, x2) - java.lang.Math.min(x, x2), 2);
   double yResult = java.lang.Math.pow(java.lang.Math.max(y, y2) - java.lang.Math.min(y, y2), 2);
   double zResult = java.lang.Math.pow(java.lang.Math.max(z, z2) - java.lang.Math.min(z, z2), 2);
   return java.lang.Math.sqrt(xResult + yResult + zResult);
 }
예제 #2
0
 // 计算用户组权限
 public String parseRight(String s_right) {
   int i_Right, i_RightNum;
   String s_rtnRight;
   i_Right = 0;
   i_RightNum = Integer.parseInt(s_right);
   if (i_RightNum != 0) i_Right = i_Right + (int) java.lang.Math.pow(2, i_RightNum - 1);
   s_rtnRight = Integer.toString(i_Right);
   return s_rtnRight;
 }
예제 #3
0
 // 计算用户和菜单权限
 public String parseRight(String[] s_right) {
   int i_Right, i_RightNum;
   String s_rtnRight;
   i_Right = 0;
   for (int i = 0; i < s_right.length; i++) {
     i_RightNum = Integer.parseInt(s_right[i]);
     if (i_RightNum != 0) i_Right = i_Right + (int) java.lang.Math.pow(2, i_RightNum - 1);
   }
   s_rtnRight = Integer.toString(i_Right);
   return s_rtnRight;
 }