查看: 1520|回复: 3

如何一勞永逸地徹底刪除 AutoBan。

[复制链接]
  • TA的每日心情

    2022-12-15 19:48
  • 签到天数: 6 天

    [LV.2]偶尔看看I

    74

    主题

    9

    回帖

    355

    积分

    中级会员

    Rank: 3Rank: 3

    积分
    355
    QQ
    发表于 2022-12-1 20:20:23 | 显示全部楼层 |阅读模式
    1. 好的,首先進入 src/net/sf/odinms/server/AutobanManager.java (所有服務器都有這個)
    這是一個基本的 AutobanManager.java 的樣子:

    [JavaScript] 纯文本查看 复制代码
    package net.sf.odinms.server;
    
    import java.rmi.RemoteException;
    import java.util.HashMap;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    import java.util.TreeSet;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.tools.MaplePacketCreator;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    public class AutobanManager implements Runnable {
    
        private static class ExpirationEntry implements Comparable<ExpirationEntry> {
    
            public long time;
            public int acc,  points;
    
            public ExpirationEntry(long time, int acc, int points) {
                this.time = time;
                this.acc = acc;
                this.points = points;
            }
    
            public int compareTo(AutobanManager.ExpirationEntry o) {
                return (int) (time - o.time);
            }
        }
        private Map<Integer, Integer> points = new HashMap<Integer, Integer>();
        private Map<Integer, List<String>> reasons = new HashMap<Integer, List<String>>();
        private Set<ExpirationEntry> expirations = new TreeSet<ExpirationEntry>();
        private static final int AUTOBAN_POINTS = 300000;
        private static AutobanManager instance = null;
        private static Logger log = LoggerFactory.getLogger(AutobanManager.class);
    
        public static AutobanManager getInstance() {
            if (instance == null) {
                instance = new AutobanManager();
            }
            return instance;
        }
    
        public void autoban(MapleClient c, String reason) {
            if (c.getPlayer().gmLevel() >= 1) {
            }
            addPoints(c, AUTOBAN_POINTS, 0, reason);
        }
    
        public synchronized void addPoints(MapleClient c, int points, long expiration, String reason) {
            // if (c.getPlayer().isGM()) return;
            int acc = c.getPlayer().getAccountID();
            List<String> reasonList;
            if (this.points.containsKey(acc)) {
                if (this.points.get(acc) >= AUTOBAN_POINTS) {
                    return;
                }
                this.points.put(acc, this.points.get(acc) + points);
                reasonList = this.reasons.get(acc);
                reasonList.add(reason);
            } else {
                this.points.put(acc, points);
                reasonList = new LinkedList<String>();
                reasonList.add(reason);
                this.reasons.put(acc, reasonList);
            }
            if (this.points.get(acc) >= AUTOBAN_POINTS) {
                String name = c.getPlayer().getName();
                StringBuilder banReason = new StringBuilder("Autoban for char ");
                banReason.append(name);
                banReason.append(" (IP ");
                banReason.append(c.getSession().getRemoteAddress().toString());
                banReason.append("): ");
                for (String s : reasons.get(acc)) {
                    banReason.append(s);
                    banReason.append(", ");
                }
    
                if (c.getPlayer().gmLevel() >= 1) {
                } else {
                    c.getPlayer().ban(banReason.toString());
                    try {
                        c.getChannelServer().getWorldInterface().broadcastMessage(null,
                                MaplePacketCreator.serverNotice(0, "[Autoban] " + name + " banned by the system (Last reason: " + reason + ")").getBytes());
                    } catch (RemoteException e) {
                        c.getChannelServer().reconnectWorld();
                    }
                    log.warn("[h4x] Autobanned player {} (accountid {})", name, acc);
                }
                return;
            }
            if (expiration > 0) {
                expirations.add(new ExpirationEntry(System.currentTimeMillis() + expiration, acc, points));
            }
        }
    
        public void run() {
            long now = System.currentTimeMillis();
            for (ExpirationEntry e : expirations) {
                if (e.time <= now) {
                    this.points.put(e.acc, this.points.get(e.acc) - e.points);
                } else {
                    return;
                }
            }
        }
    }

    2. 尋找
    [Java] 纯文本查看 复制代码
    [/B]
      try {
                        c.getChannelServer().getWorldInterface().broadcastMessage(null,
                                MaplePacketCreator.serverNotice(0, "[Autoban] " + name + " 被系統禁止 (Last reason: " + reason + ")").getBytes( ));
                    } catch (RemoteException e) {
                        c.getChannelServer().reconnectWorld();
                    }
                    log.warn("[h4x] Autobanned player {} (accountid {})", name, acc);
    用這個替換它:
    // try {
           // c.getChannelServer().getWorldInterface().broadcastMessage(null,
           // MaplePacketCreator.serverNotice(0, "[Autoban] " + name + " 被系統禁止 (Last reason: " + reason + " )").getBytes());
           // } catch (RemoteException e) {
           // c.getChannelServer().reconnectWorld();
           // }
           // log.warn("[h4x] Autobanned player {} (accountid {})", name, acc);


    3. 保存並關閉。

    4. 編譯,並擁有一個無 Autoban 的服務器!
    轉自ragezone 論壇

    专注于GMS研究,有偿调试架设,全网最低,公益群:915210346。
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2024-8-25 05:19
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    4

    主题

    65

    回帖

    347

    积分

    中级会员

    Rank: 3Rank: 3

    积分
    347
    发表于 2024-4-4 03:05:31 | 显示全部楼层
    2222222222222222222
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2024-6-28 07:37
  • 签到天数: 10 天

    [LV.3]偶尔看看II

    2

    主题

    66

    回帖

    71

    积分

    注册会员

    Rank: 2

    积分
    71
    发表于 2024-6-19 18:13:00 | 显示全部楼层

    666666666666666
    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    2024-7-4 11:28
  • 签到天数: 6 天

    [LV.2]偶尔看看I

    0

    主题

    55

    回帖

    168

    积分

    注册会员

    Rank: 2

    积分
    168
    发表于 2024-6-29 07:46:31 | 显示全部楼层
    666666666666666666666
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    快速回复 返回顶部 返回列表