Created
July 22, 2011 21:05
-
-
Save SpaceManiac/1100423 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
package com.platymuus.bukkit.maptest; | |
import com.platymuus.bukkit.mapapi.MapAPI; | |
import com.platymuus.bukkit.mapapi.MapInfo; | |
import com.platymuus.bukkit.mapapi.TextRenderer; | |
import com.platymuus.bukkit.mapapi.TextRenderer.CharacterSprite; | |
import org.bukkit.Material; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import org.bukkit.inventory.ItemStack; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class MapTest extends JavaPlugin { | |
private MapAPI mapApi; | |
public void onEnable() { | |
mapApi = MapAPI.getInstance(); | |
System.out.println(this + " is now enabled!"); | |
} | |
public void onDisable() { | |
System.out.println(this + " is now disabled!"); | |
} | |
@Override | |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | |
if (!(sender instanceof Player)) { | |
return false; | |
} | |
Player player = (Player) sender; | |
ItemStack stack = player.getItemInHand(); | |
if (stack.getType() != Material.MAP) { | |
sender.sendMessage("You must be holding a map"); | |
return true; | |
} | |
short mapId = stack.getDurability(); | |
TextRenderer text = new TextRenderer(); | |
CharacterSprite sword = CharacterSprite.make( | |
" XX", | |
" XXX", | |
" XXX ", | |
"X XXX ", | |
" XXXX ", | |
" XX ", | |
" X X ", | |
"X X "); | |
text.setChar('\u0001', sword); | |
MapInfo info = mapApi.loadMap(player.getWorld(), mapId); | |
info.setPosition(1 << 16, 1 << 16); | |
info.setData(new byte[128 * 128]); | |
text.fancyRender(info, 10, 3, "§22;Party Members -\n" + | |
"§12;\u0001 Verrier\n§16;[§12;||||||||||||||||||||§16;] - §6;0%\n" + | |
"§12;\u0001 Dinnerbone\n§16;[§28;||||||||||§12;||||||||||§16;] - §6;50%\n" + | |
"§12;\u0001 EvilSeph\n§16;[§28;|||||§12;|||||||||||||||§16;] - §6;20%\n" + | |
"§12;\u0001 SpaceManiac\n§16;[§12;||||||||||||||||||||§16;] - §6;0%\n" + | |
"§12;\u0001 DThielke\n§16;[§28;||||||||||§12;||||||||||§16;] - §6;50%\n"); | |
mapApi.saveMap(player.getWorld(), mapId, info); | |
mapApi.sendMap(player, mapId, info.getData()); | |
return true; | |
} | |
} |
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
author: SpaceManiac | |
database: false | |
generator: http://dinnerbone.com/minecraft/tools/pluginator/ | |
main: com.platymuus.bukkit.maptest.MapTest | |
name: MapTest | |
startup: postworld | |
version: '1.0' | |
commands: | |
maptest: | |
description: Map test | |
usage: /<command> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment