Skip to content

Commit

Permalink
修改了普通玩家不能放牌子的BUG,将无法使用物品删除改为回到背�
Browse files Browse the repository at this point in the history
修正
  • Loading branch information
XUQIMING committed Sep 24, 2012
1 parent 48c7010 commit 418d749
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 11 deletions.
14 changes: 5 additions & 9 deletions .classpath
Expand Up @@ -3,14 +3,10 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Users/GQM/Desktop/server/1.25/craftbukkit-1.2.5-R4.1.jar">
<attributes>
<attribute name="javadoc_location" value="http://jd.bukkit.org/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/GQM/Desktop/server/1.25/plugins/Vault.jar"/>
<classpathentry kind="lib" path="C:/Users/GQM/Desktop/server/1.25/mods/BalkonsWeaponMod1.2.5.jar"/>
<classpathentry kind="lib" path="C:/Users/GQM/Desktop/mc new server/trddiy_breakthrough_edition/plugins/Heroes.jar"/>
<classpathentry kind="lib" path="C:/Users/GQM/Desktop/mc new server/MobArena.jar"/>
<classpathentry kind="lib" path="F:/服务端/craftbukkit-1.2.5-FML-R4.1-SNAPSHOT-76.jar"/>
<classpathentry kind="lib" path="F:/服务端/plugins/Heroes.jar"/>
<classpathentry kind="lib" path="F:/服务端/plugins/MobArena - unofficial fix.jar"/>
<classpathentry kind="lib" path="F:/服务端/plugins/Vault.jar"/>
<classpathentry kind="lib" path="F:/服务端/mods/BalkonsWeaponMod1.2.5.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file added bin/com/trddiy/by664365842/CommandListener.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/Core.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/Getname.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/ItemForXP.class
Binary file not shown.
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/MobArenaListener.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/Onlyoneweapon.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/RestrictItem.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/SignListener.class
Binary file not shown.
Binary file added bin/com/trddiy/by664365842/TalkWithServer.class
Binary file not shown.
13 changes: 13 additions & 0 deletions bin/config.yml
@@ -0,0 +1,13 @@
#开启单武器限定
Onlyoneweapon: true
#开启伤害改变(坑爹中)
Changedamage: false
#开启武器限制
RestrictItem: true
#前缀替换
Addprefix: true
ItemForXP:
Item: 283
XP: 100
MobArena:
multiply: 500
8 changes: 8 additions & 0 deletions bin/plugin.yml
@@ -0,0 +1,8 @@
name: trddiy_core
main: com.trddiy.by664365842.Core
author: 664365842
description: 天然呆核心插件
version: 1.4
commands:
trd:
description: 天然呆核心插件的主命令.
42 changes: 40 additions & 2 deletions src/com/trddiy/by664365842/RestrictItem.java
@@ -1,6 +1,8 @@
package com.trddiy.by664365842;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -40,7 +42,24 @@ public RestrictItem(Core plugin) {
+ itemstackn.getTypeId())) {// 检查是否有持有此物品的权限
a++;
// 删除物品
inv.clear(i);
inv.setItem(i, null);

boolean removed = false;

for(int j=9;j<36;j++){
if(inv.getItem(j)==null){
inv.setItem(j, itemstackn);
removed = true;
break;
}
}

if(removed==false){
Location pl = player.getLocation();
World world = player.getWorld();
world.dropItemNaturally(pl, itemstackn);
}

plugin.sendtoplayer(
player,
"你还没有受过训练使用 " + gold
Expand Down Expand Up @@ -71,7 +90,23 @@ public RestrictItem(Core plugin) {
if (player.hasPermission("itemmanager.item."
+ itemstackn.getTypeId())) {
a++;
inv.clear(i);
inv.setItem(i, null);

boolean removed = false;

for(int j=9;j<36;j++){
if(inv.getItem(j)==null){
inv.setItem(j, itemstackn);
removed = true;
break;
}
}

if(removed==false){
Location pl = player.getLocation();
World world = player.getWorld();
world.dropItemNaturally(pl, itemstackn);
}
plugin.sendtoplayer(
player,
"你还没有受过训练使用 " + gold
Expand All @@ -95,6 +130,9 @@ public void onplayerpickupitemevent(PlayerPickupItemEvent event) {
// player.sendMessage(String.valueOf(itemstackn.getTypeId()));
if (player.hasPermission("itemmanager.item."
+ item.getItemStack().getTypeId())) {
Location pl = player.getLocation();
World world = player.getWorld();
world.dropItemNaturally(pl, item.getItemStack());
item.remove();
plugin.sendtoplayer(
player,
Expand Down
3 changes: 3 additions & 0 deletions src/com/trddiy/by664365842/SignListener.java
Expand Up @@ -44,6 +44,9 @@ public SignListener(Core plugin) {
public void onplayerplaceblockevent(SignChangeEvent event) {// 检查牌子创建
Player p = event.getPlayer();
String[] lines = event.getLines();
if(lines[0].compareTo(name)!=0){
return;
}
if (Core.permission.has(p, "trd.sign.create")) {
if (lines[0].equals("[经验兑换]")) {
if (lines[1].matches("\\d+")) {
Expand Down

0 comments on commit 418d749

Please sign in to comment.