@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. JAVA中精确计算金额BigDecimal

    package com.chauvet.utils; import java.math.BigDecimal; import java.text.DecimalFormat; import java. ...

  2. python 多线程threading

    上一篇说到thread模块,我们要自己解决线程锁.其实也没有什么啦.只是现在的人都比较懒,既然有高级封装的函数为什么要自己写. 所以就有了threading. 其实都一样啦. 来一个最简单的threa ...

  3. 我用工具怎么连接不上mysql数据库的? MySql access denied for user错误

    MySql access denied for user错误 方法/步骤   MySql远程连接时的"access denied for user **@**"错误,搞的我很头大, ...

  4. 格式化用户输入的金额(处理RMB的时候适合)

    number_format($str,'2','.',','); function number($k){ if(strpos($k,'.')===false){ $ok = $k.'; }else{ ...

  5. [USACO08DEC] Trick or Treat on the Farm

    题目描述 每年万圣节,威斯康星的奶牛们都要打扮一番,出门在农场的N个牛棚里转 悠,来采集糖果.她们每走到一个未曾经过的牛棚,就会采集这个棚里的1颗糖果. 农场不大,所以约翰要想尽法子让奶牛们得到快乐. ...

  6. VB6对象与地址相互转换

    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (lpDest As ...

  7. Dos命令完成文件拷贝

    Dos命令初阶--文件拷贝 1.XCOPY命令 可以在cmd中录入:XCOPY /? 即可查看帮助 帮助: XCOPY Microsoft Windows [版本 6.2.9200] (c) 2012 ...

  8. .NET EXCEL NPOI 图片

    今天闲来无事写了下 “ .NET  用  NPOI 组件 将 图片文件 写到 EXCEL 中  ” 先看效果: 头是我加的,这个应该不是难事! 再看代码: private void button1_C ...

  9. SpringMVC学习系列-后记 开启项目的OpenSessionInView

    在系列的 SpringMVC学习系列(12) 完结篇 的示例项目中,由于当时考虑到OpenSessionInView会对性能有一定的影响,所以就没有配置项目的OpenSessionInView.在ma ...

  10. 【freemaker】之获取xml的值

    测试代码 @Test public void test09() throws Exception{ root.put("doc", NodeModel.parse(new Inpu ...