令牌“>”上的语法错误,AssignmentOperator无效

时间:2014-01-20 17:22:06

标签: java

import java.util.logging.Logger; //includes not sure if I am missing one.
import java.math.*; //includes not sure if I am missing one.
import java.util.ArrayList; //includes not sure if I am missing one.
import java.util.Comparator; //includes not sure if I am missing one.
import java.util.List; //includes not sure if I am missing one.
import org.bukkit.ChatColor; //includes not sure if I am missing one.
import org.bukkit.Location; //includes not sure if I am missing one.
import org.bukkit.command.Command; //includes not sure if I am missing one.
import org.bukkit.command.CommandSender; //includes not sure if I am missing one.
import org.bukkit.entity.EntityType; //includes not sure if I am missing one.
import org.bukkit.entity.Player; //includes not sure if I am missing one.
import org.bukkit.plugin.PluginDescriptionFile; //includes not sure if I am missing one.
import org.bukkit.plugin.java.JavaPlugin; //includes not sure if I am missing one.


            //spawning a set number of a entity in MC
    int SpawnAmount = 0;
    else if(commandLabel.equalsIgnoreCase("SpawnWave")){
        for(SpawnAmount > 0, SpawnAmount--;;){  // getting the error on this > symbol
        player.getWorld().spawnCreature(location, EntityType.ZOMBIE);
        }
    }

代码还有更多但是其他所有工作都被声明了。这是一个MC插件。我是编码的新手,很抱歉给您带来不便。

2 个答案:

答案 0 :(得分:2)

更改

for(SpawnAmount > 0, SpawnAmount--;;)

for(;SpawnAmount > 0; SpawnAmount--)

这可能就是你想要的

答案 1 :(得分:1)

for循环的语法如下for(init; condition; increment){...}

对你来说,你的循环应该是:for(;SpawnAmount > 0; SpawnAmount--)

此外,变量名称通常以小写字母开头,而类名称以大写字母开头。