我想颠倒在for()中访问List的顺序
这是我的实际代码
for(int i = 0; i < states.size(); i++) {
System.out.println(states.size());
states.get(i).update(true); // restore the first blockstate
states.remove(i); // remove the first blockstate from the list
}
Run Code Online (Sandbox Code Playgroud)
这段代码有效,但我想反过来.我已经尝试过其他方式,比如使用,i--但它没有用.有人可以提出建议吗?
如何在try-catch外获取变量x,y和z?
这是我的代码:
public static void mudarSpawn_1(GtaPlayer player, string coordenadas)
{
char[] delimiterChars = { ' ', ',' };
string text = coordenadas;
string[] words = text.Split(delimiterChars);
try
{
float x = float.Parse(words[0], System.Globalization.CultureInfo.InvariantCulture);
float y = float.Parse(words[1], System.Globalization.CultureInfo.InvariantCulture);
float z = float.Parse(words[1], System.Globalization.CultureInfo.InvariantCulture);
}
catch (Exception e)
{
player.SendClientMessage(Color.DarkOrange, "Os valores de x,y e z não foram inseridos de forma correcta, apenas podes usar numeros");
player.SendClientMessage(Color.DarkOrange, "Ex: /mudarspawn3 6321.6 , 96321.38 , 66322.2 ou /mudarspawn3 6321.6 96321.38 66322.2");
}
MSGameMysql.mudarspawn1(x, …Run Code Online (Sandbox Code Playgroud)