Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Added mob type enum and subsequently removed case sensitivity from //set with mobspawners.
Dieser Commit ist enthalten in:
Ursprung
1c4c621500
Commit
46ba1c7f5b
@ -377,17 +377,18 @@ public class WorldEdit {
|
||||
} else if (blockType == BlockType.MOB_SPAWNER) {
|
||||
if (args0.length > 1) {
|
||||
String mobName = args0[1];
|
||||
if (mobName.length() > 1) {
|
||||
mobName = mobName.substring(0, 1).toUpperCase()
|
||||
+ mobName.substring(1);
|
||||
for (MobType mobType : MobType.values()){
|
||||
if (mobType.getName().toLowerCase().equals(mobName.toLowerCase())){
|
||||
mobName = mobType.getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!server.isValidMobType(mobName)) {
|
||||
throw new InvalidItemException(arg, "Unknown mob type '" + mobName + "'");
|
||||
}
|
||||
return new MobSpawnerBlock(data, args0[1]);
|
||||
return new MobSpawnerBlock(data, mobName);
|
||||
} else {
|
||||
return new MobSpawnerBlock(data, "Pig");
|
||||
return new MobSpawnerBlock(data, MobType.PIG.getName());
|
||||
}
|
||||
|
||||
// Allow setting note
|
||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Represents chests.
|
||||
* Represents mob spawners.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
@ -45,7 +45,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
||||
*/
|
||||
public MobSpawnerBlock() {
|
||||
super(BlockID.MOB_SPAWNER);
|
||||
this.mobType = "Pig";
|
||||
this.mobType = MobType.PIG.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
54
src/main/java/com/sk89q/worldedit/blocks/MobType.java
Normale Datei
54
src/main/java/com/sk89q/worldedit/blocks/MobType.java
Normale Datei
@ -0,0 +1,54 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.blocks;
|
||||
|
||||
/**
|
||||
* Represents the possible types of mobs.
|
||||
*/
|
||||
public enum MobType {
|
||||
CAVE_SPIDER("CaveSpider"),
|
||||
CHICKEN("Chicken"),
|
||||
COW("Cow"),
|
||||
CREEPER("Creeper"),
|
||||
ENDERMAN("Enderman"),
|
||||
GHAST("Ghast"),
|
||||
GIANT("Giant"),
|
||||
MONSTER("Monster"),
|
||||
PIG("Pig"),
|
||||
PIG_ZOMBIE("PigZombie"),
|
||||
SHEEP("Sheep"),
|
||||
SILVERFISH("Silverfish"),
|
||||
SKELETON("Skeleton"),
|
||||
SLIME("Slime"),
|
||||
SPIDER("Spider"),
|
||||
SQUID("Squid"),
|
||||
ZOMBIE("Zombie"),
|
||||
WOLF("Wolf");
|
||||
|
||||
private String name;
|
||||
|
||||
private MobType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren