Skip to content

Commit

Permalink
又开新坑..
Browse files Browse the repository at this point in the history
  • Loading branch information
GQM authored and GQM committed Sep 23, 2012
1 parent e3f89fc commit 8cea859
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/com/trddiy/by664365842/CommandListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label,
plugin.sendtoserver("设置已由玩家 " + p.getName() + " 重载");
plugin.sendtoplayer(p, "设置已重载");
}
if (arg1.equals("exp") && Core.permission.has(p, "trd.exp")) {
if (args.length >=2&&arg1.equals("exp") && Core.permission.has(p, "trd.exp")) {
//plugin.sendtoplayer(p,"抱歉,功能未开放");
if(args[1] != null){
ifx.getItem(p, Integer.valueOf(args[1]));
Expand Down
8 changes: 8 additions & 0 deletions src/com/trddiy/by664365842/ItemForXP.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public void getItem(Player p, int a) {
plugin.sendtoplayer(p, "手上的东西不够!");
return;
}
if (a < 0) {
plugin.sendtoplayer(p, "经验兑换物品功能暂未开放!");
return;
}
if (a == 0) {
plugin.sendtoplayer(p, "请输入非零数字!");
return;
}
is.setAmount(is.getAmount() - a);
Hero h = plugin.getheroesplugin().getCharacterManager().getHero(p);
h.addExp(xp * a, h.getHeroClass());
Expand Down
9 changes: 8 additions & 1 deletion src/com/trddiy/by664365842/RestrictItem.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.trddiy.by664365842;

import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -13,8 +13,10 @@

public class RestrictItem implements Listener{
private Core plugin;
private SignCommand sm;
public RestrictItem(Core plugin) {
this.plugin = plugin;
sm = new SignCommand(plugin);
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
//定义颜色
Expand Down Expand Up @@ -52,6 +54,11 @@ public RestrictItem(Core plugin) {
@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event){//当玩家做出动作时 同上
Player player = event.getPlayer();
/* if(event.getClickedBlock().getTypeId()== 323){
if(Core.permission.has(player, "trd.exp.sign")){
sm.handlesign(player,(Sign)(event.getClickedBlock()));
}
}*/
if (!player.hasPermission("itemmanager.admin")) {
int a = 0;
for(int i =0 ;i<9 ;i++){
Expand Down
15 changes: 15 additions & 0 deletions src/com/trddiy/by664365842/SignCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.trddiy.by664365842;

import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;

public class SignCommand {
private Core plugin;
public SignCommand(Core plugin){
plugin = this.plugin;
}
public void handlesign(Player p , Sign s){
String[] line = s.getLines();
}
}

0 comments on commit 8cea859

Please sign in to comment.