Last active
December 14, 2015 04:48
-
-
Save Omattyao/5030485 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
<?php | |
/* | |
__PocketMine Plugin__ | |
name=IDSearcher | |
version=0.0.2 | |
author=Omattyao | |
apiversion=2 | |
class=scIDSearch | |
*/ | |
class scIDSearch extends scClass{ | |
private $blocks = array( | |
0 => "Air", | |
1 => "Stone", | |
2 => "Grass", | |
3 => "Dirt", | |
4 => "Cobblestone", | |
5 => "WoodenPlank", | |
6 => "Sapling", | |
7 => "Bedrock", | |
8 => "Water", | |
9 => "StationaryWater", | |
10 => "Lava", | |
11 => "StationaryLava", | |
12 => "Sand", | |
13 => "Gravel", | |
14 => "GoldOre", | |
15 => "IronOre", | |
16 => "CoalOre", | |
17 => "Wood", | |
18 => "Leaves", | |
19 => "Sponge", | |
20 => "Glass", | |
21 => "LapisLazuliOre", | |
22 => "LapisLazuliBlock", | |
23 => "Dispenser", | |
24 => "Sandstone", | |
25 => "NoteBlock", | |
26 => "Bed", | |
27 => "PoweredRail", | |
28 => "DetectorRail", | |
29 => "StickyPiston", | |
30 => "Cobweb", | |
31 => "TallGrass", | |
32 => "DeadShrub", | |
35 => "Wool", | |
37 => "YellowFlower", | |
38 => "CyanFlower", | |
39 => "BrownMushroom", | |
40 => "RedMushroom", | |
41 => "BlockofGold", | |
42 => "BlockofIron", | |
44 => "StoneSlab", | |
45 => "Brick", | |
46 => "TNT", | |
47 => "Bookcase", | |
48 => "MossStone", | |
49 => "Obsidian", | |
50 => "Torch", | |
51 => "Fire", | |
52 => "MobSpawner", | |
53 => "WoodenStairs", | |
56 => "DiamondOre", | |
57 => "BlockofDiamond", | |
58 => "Workbench", | |
59 => "Wheat", | |
60 => "Farmland", | |
61 => "Furnace", | |
62 => "Furnace", | |
63 => "Sign", | |
64 => "WoodDoor", | |
65 => "Ladder", | |
66 => "Rails", | |
67 => "CobblestoneStairs", | |
68 => "Sign", | |
71 => "IronDoor", | |
73 => "RedstoneOre", | |
78 => "Snow", | |
79 => "Ice", | |
80 => "SnowBlock", | |
81 => "Cactus", | |
82 => "ClayBlock", | |
83 => "SugarCane", | |
85 => "Fence", | |
87 => "Netherrack", | |
88 => "SoulSand", | |
89 => "Glowstone", | |
96 => "Trapdoor", | |
98 => "StoneBricks", | |
99 => "BrownMushroom", | |
100 => "RedMushroom", | |
102 => "GlassPane", | |
103 => "Melon", | |
105 => "MelonVine", | |
107 => "FenceGate", | |
108 => "BrickStairs", | |
109 => "StoneBrickStairs", | |
112 => "NetherBrick", | |
114 => "NetherBrickStairs", | |
128 => "SandstoneStairs", | |
155 => "BlockofQuartz", | |
156 => "QuartzStairs", | |
245 => "StoneCutter", | |
246 => "GlowingObsidian", | |
247 => "NetherReactorCore", | |
); | |
private $items = array( | |
256 => "IronShovel", | |
257 => "IronPickaxe", | |
258 => "IronAxe", | |
259 => "FlintandSteel", | |
260 => "Apple", | |
261 => "Bow", | |
262 => "Arrow", | |
263 => "Coal", | |
264 => "DiamondGem", | |
265 => "IronIngot", | |
266 => "GoldIngot", | |
267 => "IronSword", | |
268 => "WoodenSword", | |
269 => "WoodenShovel", | |
270 => "WoodenPickaxe", | |
271 => "WoodenAxe", | |
272 => "StoneSword", | |
273 => "StoneShovel", | |
274 => "StonePickaxe", | |
275 => "StoneAxe", | |
276 => "DiamondSword", | |
277 => "DiamondShovel", | |
278 => "DiamondPickaxe", | |
279 => "DiamondAxe", | |
280 => "Stick", | |
281 => "Bowl", | |
282 => "MushroomStew", | |
283 => "GoldSword", | |
284 => "GoldShovel", | |
285 => "GoldPickaxe", | |
286 => "GoldAxe", | |
287 => "String", | |
288 => "Feather", | |
289 => "Gunpowder", | |
290 => "WoodenHoe", | |
291 => "StoneHoe", | |
292 => "IronHoe", | |
293 => "DiamondHoe", | |
294 => "GoldHoe", | |
295 => "WheatSeeds", | |
296 => "Wheat", | |
297 => "Bread", | |
298 => "LeatherHelmet", | |
299 => "LeatherChestplate", | |
300 => "LeatherLeggings", | |
301 => "LeatherBoots", | |
302 => "ChainmailHelmet", | |
303 => "ChainmailChestplate", | |
304 => "ChainmailLeggings", | |
305 => "ChainmailBoots", | |
306 => "IronHelmet", | |
307 => "IronChestplate", | |
308 => "IronLeggings", | |
309 => "IronBoots", | |
310 => "DiamondHelmet", | |
311 => "DiamondChestplate", | |
312 => "DiamondLeggings", | |
313 => "DiamondBoots", | |
314 => "GoldHelmet", | |
315 => "GoldChestplate", | |
316 => "GoldLeggings", | |
317 => "GoldBoots", | |
318 => "Flint", | |
319 => "RawPorkchop", | |
320 => "CookedPorkchop", | |
321 => "Painting", | |
322 => "GoldApple", | |
323 => "Sign", | |
332 => "Snowball", | |
334 => "Leather", | |
336 => "ClayBrick", | |
337 => "Clay", | |
338 => "SugarCane", | |
339 => "Paper", | |
340 => "Book", | |
344 => "Egg", | |
348 => "GlowstoneDust", | |
352 => "Bone", | |
353 => "Sugar", | |
355 => "Bed", | |
359 => "Shears", | |
360 => "Melon", | |
362 => "MelonSeeds", | |
363 => "RawBeef", | |
364 => "Steak", | |
365 => "RawChicken", | |
366 => "CookedChicken", | |
405 => "NetherBrick", | |
456 => "Camera", | |
); | |
public function init() { | |
$cmds = array('blockid' => 'commandH', 'itemid' => 'commandH'); | |
return $cmds; | |
} | |
public function commandH($cmd, $args){ | |
$output = ""; | |
switch ($cmd) { | |
case 'blockid': | |
$results = $this->blocks; | |
if (empty($args)) { | |
$output .= "Usage: /blockid <BlockName>\n"; | |
break; | |
} | |
foreach ($args as $pettern) { | |
$results = preg_grep("/.*$pettern.*/i", $results); | |
} | |
$match = count($results); | |
$pettern = implode(" ", $args); | |
$output .= "[INFO] Search result: \"$pettern\" {$match}hits\n"; | |
foreach ($results as $block) { | |
$id = array_search($block, $this->blocks); | |
$output .= "($id)$block "; | |
} | |
break; | |
case 'itemid': | |
$results = $this->items; | |
if (empty($args)) { | |
$output .= "Usage: /itemid <ItemName>\n"; | |
break; | |
} | |
foreach ($args as $pettern) { | |
$results = preg_grep("/.*$pettern.*/i", $results); | |
} | |
$match = count($results); | |
$pettern = implode(" ", $args); | |
$output .= "[INFO] Search result: \"$pettern\" {$match}hits\n"; | |
foreach ($results as $block) { | |
$id = array_search($block, $this->items); | |
$output .= "($id)$block "; | |
} | |
break; | |
} | |
return $output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment