@ECHO OFF
SET CATALINA_OPTS= -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar -Xmx1024m -Xms512m -XX:MaxPermSize=256M -Dfile.encoding=utf-8 -Duser.timezone=Asia/Hong_Kong spigot_server.jar
pause

package net.han;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap;
import java.util.Map; /**
* Created by han on 2016/1/30.
*/
public final class BuildClonePlugin extends JavaPlugin {
Map playerList=new HashMap();
@Override
public void onEnable() {
getLogger().info("xiao_xi 插件激活!");
this.getCommand("xiaoxi").setExecutor(new MyPluginCommandExecutor(this));
for (Player player : Bukkit.getServer().getOnlinePlayers()) { playerList.put(player.getName(), playerData(player));
}
} private Object playerData(Player player) { return player;
} @Override
public void onDisable() {
getLogger().info("xiao_xi 插件退出!");
}
public void onPlayerJoin(PlayerJoinEvent evt) {
Player player = evt.getPlayer(); // The player who joined
PlayerInventory inventory = player.getInventory(); // The player's inventory
ItemStack itemstack = new ItemStack(Material.DIAMOND, 64); // A stack of diamonds if (inventory.contains(itemstack)) {
inventory.addItem(itemstack); // Adds a stack of diamonds to the player's inventory
player.sendMessage("Welcome! You seem to be reeeally rich, so we gave you some more diamonds!");
}
} @EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
// Get the player's location.
Location loc = event.getPlayer().getLocation();
// Sets loc to five above where it used to be. Note that this doesn't change the player's position.
loc.setY(loc.getY() + 5);
// Gets the block at the new location.
Block b = loc.getBlock();
// Sets the block to type id 1 (stone).
b.setType(Material.STONE);
} }

  

package net.han;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import java.util.ArrayList;
import java.util.List; /**
* Created by han on 2016/1/30.
*/
public class MyPluginCommandExecutor implements CommandExecutor {
private World world;
private Location location;
private final BuildClonePlugin plugin;
private Player player;
private Inventory inventory; public MyPluginCommandExecutor(BuildClonePlugin plugin) {
this.plugin = plugin; // Store the plugin in situations where you need it.
} @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length > 5) {
sender.sendMessage("Too many arguments!");
return false;
}
if (args.length < 3) {
sender.sendMessage("Not enough arguments!");
return false;
} /* Player target = (Bukkit.getServer().getPlayer(args[0]));
if (target == null) {
sender.sendMessage(args[0] + " is not online!");
plugin.getLogger().info(args[0]);
return false;
}*/
String cmdCV=args[0];
String X= args[1];
String Y =args[2];
String Z=args[3];
plugin.getLogger().info(cmdCV + " X=" + X + ",Y=" + Y + ",Z=" + Z);
if (sender instanceof Player) {
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("xiaoxi")) {
player = (Player) sender;
plugin.getLogger().info(player.getDisplayName() + " use command xiaoxi");
world = player.getWorld();
location = player.getLocation();
inventory = player.getInventory();
if (args[0].equalsIgnoreCase("m"))
generateCube( location,Integer.parseInt(args[1])); if (args[0].equalsIgnoreCase("c"))
copyCube(location, Integer.parseInt(args[1]), Integer.parseInt(args[2]),Integer.parseInt(args[3])); if (args[0].equalsIgnoreCase("v"))
pasteCube(location, Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])); return true;
}
} else {
sender.sendMessage("You must be a player!");
return false;
}
// do something
return false; }
private List<LocCub> cvList =null; public void copyCube(Location loc,int X,int Y,int Z ){
int x1 = loc.getBlockX();
int y1 = loc.getBlockY();
int z1 = loc.getBlockZ();
cvList=new ArrayList<LocCub>(); // Figure out the opposite corner of the cube by taking the corner and adding length to all coordinates.
int x2 = x1 + X;
int y2 = y1 + Y;
int z2 = z1 + Z;
World world = loc.getWorld();
for (int xPoint = x1; xPoint <= x2; xPoint++) {
// Loop over the cube in the y dimension.
for (int yPoint = y1; yPoint <= y2; yPoint++) {
// Loop over the cube in the z dimension.
for (int zPoint = z1; zPoint <= z2; zPoint++) {
// Get the block that we are currently looping over.
Block currentBlock = world.getBlockAt(xPoint, yPoint, zPoint);
// Set the block to type 57 (Diamond block!)
cvList.add(new LocCub(xPoint-x1, yPoint-y1, zPoint-z1 ,currentBlock));
// currentBlock.setType(Material.DIAMOND_BLOCK);
plugin.getLogger().info(" X=" + xPoint + ",Y=" + yPoint + ",Z=" + zPoint);
}
}
}
}
private void pasteCube(Location loc,int X,int Y,int Z ){ World world = loc.getWorld();
for (LocCub locCub : cvList){
Block block = locCub.getBlock(); Block currentBlock = world.getBlockAt(loc.getBlockX()+locCub.getX(),
loc.getBlockY()+locCub.getY(),
loc.getBlockZ()+locCub.getZ()); plugin.getLogger().info(" X=" + (loc.getBlockX()+locCub.getX()) + "," +
" Y=" + (loc.getBlockY()+locCub.getY()) + "," +
" Z=" + (loc.getBlockZ()+locCub.getZ()));
currentBlock.setType(block.getType());
} }
public void generateCube(Location loc, int length) {
// Set one corner of the cube to the given location.
// Uses getBlockN() instead of getN() to avoid casting to an int later.
int x1 = loc.getBlockX();
int y1 = loc.getBlockY();
int z1 = loc.getBlockZ(); // Figure out the opposite corner of the cube by taking the corner and adding length to all coordinates.
int x2 = x1 + length;
int y2 = y1 + length;
int z2 = z1 + length; World world = loc.getWorld(); // Loop over the cube in the x dimension.
for (int xPoint = x1; xPoint <= x2; xPoint++) {
// Loop over the cube in the y dimension.
for (int yPoint = y1; yPoint <= y2; yPoint++) {
// Loop over the cube in the z dimension.
for (int zPoint = z1; zPoint <= z2; zPoint++) {
// Get the block that we are currently looping over.
Block currentBlock = world.getBlockAt(xPoint, yPoint, zPoint);
// Set the block to type 57 (Diamond block!)
currentBlock.setType(Material.DIAMOND_BLOCK);
}
}
}
}
}
package net.han;

import org.bukkit.block.Block;

/**
* Created by han on 2016/1/30.
*/
public class LocCub {
int X ; public int getY() {
return Y;
} public void setY(int y) {
Y = y;
} public int getX() {
return X;
} public void setX(int x) {
X = x;
} public int getZ() {
return Z;
} public void setZ(int z) {
Z = z;
} int Y;
int Z;
Block block; public LocCub() {
} public LocCub(int xPoint, int yPoint, int zPoint, Block currentBlock) {
X=xPoint;Y=yPoint;Z=zPoint;block=currentBlock;
} public Block getBlock() {
return block;
} public void setBlock(Block block) {
this.block = block;
} }
name: buildClone
main: net.han.BuildClonePlugin
version: 1
author: xiao_xi
commands:
xiaoxi:
description: This is a demo command.
usage: /xiaoxi [c/v/m] [x] [y] [z]
permission: buildClone.*
permission-message: You don't have <permission>
permissions:
buildClone.*:
description: copy or paste build
children:
buildClone.c: true
buildClone.v: true
buildClone.c:
description: Allows you to kick a user
default: op
buildClone.v:
description: Allows you to kick a user
default: op doorman.*:
description: Gives access to all doorman commands
children:
doorman.kick: true
doorman.ban: true
doorman.knock: true
doorman.denied: false
doorman.kick:
description: Allows you to kick a user
default: op
doorman.ban:
description: Allows you to ban a user
default: op
doorman.knock:
description: Knocks on the door!
default: true
doorman.denied:
description: Prevents this user from entering the door

MC java 远程调试 plugin 开发的更多相关文章

  1. Java远程调试 java -Xdebug各参数说明

    JAVA自身支持调试功能,并提供了一个简单的调试工具--JDB,类似于功能强大的GDB,JDB也是一个字符界面的 调试环境,并支持设置断点,支持线程线级的调试 JAVA的调试方法如下: 1.首先支持J ...

  2. CLion远程调试嵌入式开发板程序

    CLion远程调试嵌入式开发板程序 目录 CLion远程调试嵌入式开发板程序 1. 目的 2. 前提条件 3. CLion设置 3.1 设置一个Deployment 3.2 上传需要的目录到目标板子 ...

  3. linux下的java远程调试jpda+tomcat

    项目放到linux服务器了,服务器的环境或者数据可能和我们本地不一样,这个时候我们可能需要远程的断点进行调试,来查看请求过程中的各个变量的值.这里我们的应用服务器用的tomcat5.5.17 这个时候 ...

  4. 如何远程调试自定义开发的Flume应用

    一.前言 Flume作为当下最流行的大数据采集组件之一.其本身拥有分布式/高可靠/高可用等优点,但相比较于Flink/Spark/Kafka等大数据组件,其对于本地调试的功能支持度并不高,如果我们没有 ...

  5. Java远程调试代码不一致问题汇总

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  6. java远程调试(断点)程序/tomcat( eclipse远程调试Tomcat方法)

    tomcat远程调试: 1.Linux中配置tomcat在catalina.sh中添加如下CATALINA_OPTS="-Xdebug  -Xrunjdwp:transport=dt_soc ...

  7. 使用java远程调试技术监控代码运行

    JAPA介绍 JPDA(Java Platform Debugger Architecture)是 Java 平台调试体系结构的缩写,通过 JPDA 提供的 API,开发人员可以方便灵活的搭建 Jav ...

  8. java远程调试(idea)

    遇见一个怪异问题,无奈线上数据库有限制,只能远程调试下代码.突然发现,远程调试代码真的好简单,简单记录下操作步骤. 1.在idea里创建一个Remote,远程连接的入口. 找到 Edit Config ...

  9. JAVA远程调试

    1.远程端启动必须添加jvm参数 -Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=${debug_port} 其中de ...

随机推荐

  1. RPM卸载软件包

    如何卸载rpm包 首先:通过  rpm -q <关键字> 可以查询到rpm包的名字 然后:调用 rpm -e <包的名字> 删除特定rpm包 如果遇到依赖,无法删除,使用 rp ...

  2. 《C与指针》第三章练习

    本章问题 1.What is the range for characters and the various integer types on your machine? (在你的机器上,字符型和整 ...

  3. SQLite语句练习题

    1. 查询Student表中的所有记录的Sname.Ssex和Class列. 2. 查询教师所有的单位即不重复的Depart列. 3. 查询Student表的所有记录. 4. 查询Score表中成绩在 ...

  4. 2016HUAS_ACM暑假集训3B - Frogger

    好几天没更新博客了,因为这周在看关于图论的算法,有好几个(还是英文名字-_-||),人晕晕的...... 说一下这个Frogger吧.这个题目的话......难的不是做法,而是题意... 大致题意:有 ...

  5. 简单的鼠标可拖动div 兼容IE/FF

    来源:http://www.cnblogs.com/imwtr/p/4355416.html 作者: 主要思路: 一个div,注册监听onmousedown事件,然后处理获取的对象及其相关值(对象高度 ...

  6. Spring 中的default-lazy-init="true" 和 lazy-init="true"

    1.spring的default-lazy-init参数 spring在启动的时候,会默认加载会默认加载整个对象实例图,从初始化ACTION配置.到 service配置到dao配置.乃至到数据库连接. ...

  7. [Tex学习笔记]一个数学公式

    \begin{equation*} \begin{aligned} &\quad\int |\nabla(T_1-\overline{T})^+|^2 \rm dx-\int \frac{3m ...

  8. 查看并更改mysql编码

    show variables like 'character%'; set character_set_client=utf8 ; set character_set_connection=utf8 ...

  9. str转unsigned int

    用法 1 参数:参数类型为char, 十六进制字符串形式:0X××××××[NUT],十进制字符串形式:×××××××[NUT],字符串的最大长度为16,字符串结尾符必须为ascii码值0(NUT). ...

  10. 微信订阅号里实现oauth授权登录,并获取用户信息 (完整篇)

    摘要 这段时间一直有人问我,订阅号实现的oauth授权登录的问题,之前写的比较简单,很多人不明白.众所周知,微信公众号分订阅号.服务号.企业号:每个号的用途不一样,接口开放程度也不一样.微信还有个扯淡 ...