Skip to content

Instantly share code, notes, and snippets.

View imDaniX's full-sized avatar
😼
Lazing around

Daniil Zao. imDaniX

😼
Lazing around
  • datagile.ru
  • Russia
View GitHub Profile
@imDaniX
imDaniX / LocationUtils.java
Created February 27, 2023 02:42
Traversing edges of a cuboid
public class LocationUtils {
public static void traverseEdges(LocationConsumer consumer, Location aLoc, Location bLoc, double step) {
World world = aLoc.getWorld();
double[] xArr = {Math.min(aLoc.getX(), bLoc.getX()), Math.max(aLoc.getX(), bLoc.getX())};
double[] yArr = {Math.min(aLoc.getY(), bLoc.getY()), Math.max(aLoc.getY(), bLoc.getY())};
double[] zArr = {Math.min(aLoc.getZ(), bLoc.getZ()), Math.max(aLoc.getZ(), bLoc.getZ())};
for (double x = xArr[0]; x < xArr[1]; x += step) for (double y : yArr) for (double z : zArr) {
consumer.accept(world, x, y, z);
@imDaniX
imDaniX / MiniTranslator.java
Last active February 27, 2023 02:55
Legacy to MiniMessage-acceptable string
/*
MIT License
Copyright (c) 2022 Daniil Z. (idanix@list.ru)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@imDaniX
imDaniX / rubukkit-upgraded.user.js
Last active February 19, 2024 13:04
RuBukkit Upgraded
// ==UserScript==
// @name RuBukkit Upgraded
// @namespace imDaniX:rubukkit
// @updateURL https://gist.github.com/imDaniX/88206ef3b96720f66f97f07a0fc2def9/raw/rubukkit-upgraded.user.js
// @downloadURL https://gist.github.com/imDaniX/88206ef3b96720f66f97f07a0fc2def9/raw/rubukkit-upgraded.user.js
// @version 0.3.17
// @description A better way of using RuBukkit
// @author imDaniX
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
// @match http://*.rubukkit.org/*
@imDaniX
imDaniX / wide-rubukkit.user.css
Last active February 19, 2024 08:43
Wide RuBukkit
/* ==UserStyle==
@name Wide RuBukkit
@namespace imDaniX:rubukkit
@updateURL https://gist.github.com/imDaniX/1e8f228dbe13c37e48da189303002be0/raw/wide-rubukkit.user.css
@homepageURL https://rubukkit.org/threads/wide-rubukkit-walks-ctil-dlja-stylus.175623/
@version 1.0.22
@preprocessor stylus
@description Простенький стиль для обновления визуала rubukkit.org
@var text maxWidth "Максимальная ширина основного окна" 1200px
@var checkbox newLogo "Использовать логотип от RBWide?" 0
@imDaniX
imDaniX / CaseInsensitiveMap.java
Last active May 30, 2021 12:39
String case-insensitive HashMap, TreeMap<String, V>(String.CASE_INSENSITIVE_ORDER) alternative
package your.package;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@imDaniX
imDaniX / README Антимат.md
Last active April 16, 2024 18:28
Мат фильтр | Регулярка антимат

Регулярное выражение для нахождения русского мата в тексте. Использовать следует только для первичной модерации, ибо обходится нажатием в одну клавишу. Если вам требуется полноценный фильтра мата, советую прибегнуть к программному пути создания такового, найти третье API, или просто остановиться на ручной модерации.

Выражение писалось в первую очередь с оглядкой на регулярки Java - для других языков может потребоваться адаптация.

Основа регулярного выражения

\b(
((у|[нз]а|(хитро|не)?вз?[ыьъ]|с[ьъ]|(и|ра)[зс]ъ?|(о[тб]|п[оа]д)[ьъ]?|(.\B)+?[оаеи-])-?)?(
  [её](б(?!о[рй]|рач)|п[уа](ц|тс))|
  и[пб][ае][тцд][ьъ]
@imDaniX
imDaniX / SilentConsoleSender.java
Last active May 18, 2020 01:49
SilentConsoleSender
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
@imDaniX
imDaniX / config.yml
Last active February 6, 2021 15:22
Dangerous Caves 2
# | Dangerous Caves by Evil-Lootlye
# | Recoded by imDaniX
# Version of this configuration file
version: 24
# NOTE: Chances
# All the chances are in percents
# NOTE: Formulas